I have some code that works about like I want with one small glitch. The alert works when the character count in incorrect, and it keeps focus on the field. The problem is that after the correct number of characters are entered in the field, it still keeps focus on the field until you tab out of it.
I need it to work like it does, with the exception that when the correct number of characters is entered, it needs to go to the next field automatically.
If the alert is removed, it works correctly, except, of course, I do not get the alert. Here is my code.
var r = new RegExp();
r.compile("^([0-9]{8})$","i");
var result = r.test(this.rawValue);
if (result == true)
true;
else
app.alert("SAP numbers are 8 digits. Please re-enter the SAP number.", 0);
xfa.host.setFocus(this);
Thanks
try using "xfa.host.messageBox" instead of "app.alert" for the popup.
Rgds,