Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Move cursor to a text field once a checkbox has been selected (out of the tabbing order)

Avatar

Former Community Member
I have a form that has multiple "Other" checkboxes. When a user clicks on any of the "Other" fields a box pops up and tells them they need to explain in detail in the "Notes" section.



1. How can I get the cursor to move down to the "Notes" section when someone clicks any of the "Other" checkboxes?

2. Can I do a validation on my submit button to see if any of the "Other" checkboxes have been selected and if so, make sure that the "Notes" field isn't null?



Hopefully that makes sense. Thanks for any help you can provide.
5 Replies

Avatar

Former Community Member
On the exit of the checkbox you can use the command:



if (checkbox is checked)

xfa.host.setFocus("comment field name");

Avatar

Former Community Member
Does it matter that my "Notes" field is in a different subform than where my "Other" fields are?

Avatar

Former Community Member
For that call it does not matter as each field must have a unique name anyways.

Avatar

Former Community Member
This is the code I have :

if (this.rawValue ==1){

xfa.host.setFocus("Notes");

}



When I tab out of the "Other" field it does not move to the "Notes" field. What am I missing?

Avatar

Former Community Member
I got it to work on the exit event I put in:<br />xfa.host.setFocus(xfa.resolveNode("form1.RequestFormP1.subMainP1.subNotes.notes").somExpression); <br /><br />Got it from this blurb in another thread:<br />A way could be to create an enter event on the field that you want to skip, and then set focus to the field you want to jump to. <br /><br />On the field you want to skip <br />1) find the enter event in the event dropDown <br />2) make sure javascript code is selected <br />3) type xfa.host.setFocus( <field_name> ); <br /> in code window you can hold down CTRL and click the other field, and the reference will be inserted, eg. <br /><br />xfa.host.setFocus( xfa.resolveNode("MY_FORM.P1.fieldName").somExpression ); <br /><br />Thanks for the help!