Keeping focus after validation error and alert


i have code works want 1 small glitch. alert works when character count in incorrect, , keeps focus on field. problem after correct number of characters entered in field, still keeps focus on field until tab out of it.

 

i need work does, exception when correct number of characters entered, needs go next field automatically.

 

if alert removed, works correctly, except, of course, not alert. here 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 8 digits. please re-enter sap number.", 0);
    xfa.host.setfocus(this);

 

thanks

you need add braces else. without braces executes first statement setfocus executes. habit use braces on if-else statements.

 

if (result == true) {

    true;

}

else {

    app.alert("sap numbers 8 digits. please re-enter sap number.", 0);

    xfa.host.setfocus(this);

}

 

steve



More discussions in LiveCycle Forms


adobe

Comments

Popular posts from this blog

How to decompile jsxbin to jsx

Gavik Photoslide GK2: Not able to upload photos - Joomla! Forum - community, help and support

Phoca Guestbook logger registret bruger af - Joomla! Forum - community, help and support