Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

keep coursor on wrong field

Avatar

Level 5

Hi All.

I validate NumericField on EXIT event. When I get error message and click OK button I'm returning to form and coursor points to next form's field. How to keep coursor on wrong field after button OK is clicked on error message and use EXIT event?

Thanks.

4 Replies

Avatar

Level 7

I've never found a great way to do this. The closest I've come is to validate the field on the enter event of the next field in the tab order using a script and then set the focus back to the invalid field. For example:

if (num1.rawValue < 21){

xfa.host.messageBox("Must be more than 20!");

xfa.host.setFocus(form1.subform1.num1);

}

Avatar

Level 5

Hi djaknow. Thanks for replay.

I tried your code. When I return back to form the cursor don't fosuc on failed field it jump to next. How it to fix.

Thanks.

Avatar

Level 7

Hmm... for me, it puts the focus back into the field referenced in the setFocus script. When you try it, the focus doesn't go to the field specified after you clear the message box?

Avatar

Level 5

No. The cursor move to next field and didn't focus on specified field.