iPad differences

It seems that iPad doesn’t like the onElementFocusGained and onElementFocusLost form events. I have a global method to highlight the current field by changing the background color. Works fine on most platforms but on iPad it causes the keyboard to hide as each field is entered.

function onElementFocusChanged(event) {
	var vElem = event.getElementName()
	var vEventType = event.getType()
	var vForm = event.getFormName()
	if (vElem && vForm)
	{	
		var vElementType = forms[vForm].elements[vElem].getElementType();
//		application.output(vElementType)
		if (vElementType == ELEMENT_TYPES.TEXT_FIELD || vElementType == "TYPE_AHEAD") // doesn't look nice on combobox
		{
			if (vEventType == "focusGained")
			{
				forms[vForm].elements[vElem].bgcolor =  '#ffffcc' // pale yellow
				//'#ccffff' // pale blue
				//'#ffffcc' // pale yellow
				//'#ffff99' // yellow
			}
			else {
				forms[vForm].elements[vElem].bgcolor = '#ffffff' // white
			}				
		}
	}
}

I’ve tried this to remove the methods when an iPad is detected.

function fixIpad() {
	var vAgent = Packages.org.apache.wicket.Session.get().getClientInfo().getUserAgent()
	var vIpad = utils.stringPatternCount(vAgent,"iPad")>0
	if (vIpad)
	{
		var vForm = solutionModel.getForm("ce_frm_invoices");
		vForm.onElementFocusGained = SM_DEFAULTS.NONE
		vForm.onElementFocusLost = SM_DEFAULTS.NONE
	}
}

However I get an error
Cannot convert -1 to com.servoy.j2db.scripting.solutionmodel.JSMethod

I would do this in the servoy_webclient_default.css.

One place, for ALL web-client fields…

Thanks Harjo, I only want to do it for WC on iPad. WC on other platforms handles the event ok.

for setting method references to null you have to use SM_DEFAULTS.COMMAND_NONE

Will look if we can make that a little bit more clear.

Edit: Or just use form.myevent = null;

I wonder if the behaviour could be fixed, so we can use onElementFocusChanged(event) on iPad?