I have a method which is triggered by onFocusLost event.
This method validates the field value & if the field value is not correct then
the method should give focus to the same field.
if (result) {
plugins.dialogs.showErrorDialog('Error', message, 'OK');
forms[formName].elements[elementName].requestFocus();
}
The above method is working good, but it triggers 3 times. Why it is happening?
Are you sure that works?
I keep getting multiple messages.
The manual click out of the field AND the open dialog step, seem to both trigger the onFocusLost.
Here’s one workaround(that is, if your code logic allows for emptying result variable)
if (result) {
plugins.dialogs.showErrorDialog('Error', message, 'OK');
result = "";
forms[formName].elements[elementName].requestFocus(false);
}
var email = forms[formName][elementName];
var result = plugins.it2be_tools.isEmail(email);
if (result) {
plugins.dialogs.showErrorDialog('Error', message, 'OK');
forms[formName].elements[elementName].requestFocus(false);
}