Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Tabbing with 'Enter'?

Avatar

Former Community Member
Hello,



using Designer 7, is it possible allow tabbing through a form with the 'Enter' key? if so, how should I go about it?



Many thanks



Benoit
5 Replies

Avatar

Former Community Member
Sure, you can do that. Put this script into the exit event using javascript, where fieldname is the field you want the tab to move into.



xfa.host.setFocus("fieldname");

Avatar

Former Community Member
Thanks for the reply, David. I must admit I'm not sure I understand, though!



I've included the script in the exit event for the first field that has to be completed on the form. That field's name is 'TextField2', which I have used to replace "fieldname" in the script. I then saved the form.



Now when I try the form, I click in 'TextField2' to position my cursor, enter data and then press 'Enter'. The cursor disappears! The data I eneterd stays put but I can't find the cursor nowhere.



When I try looking on other pages of the form to see if I can find the cursor, Designer will not let me go there and brings me back to the 'TextField2' where I see the text I entered now highlighted.



If I do not try to search for the cursor through the form but simply press 'Enter' again, the cursor comes back at the exact same spot where I started in 'TextField2', with the text I entered still showing.



Any idea what I am missing?



Benoit

Avatar

Former Community Member
Let's say you have 3 text fields that you want to tab through, tf1, tf2 and tf3. In tf1, your script will be:



xfa.host.setFocus("tf2");



In tf2, your script will be:



xfa.host.setFocus("tf3");



In each field you want to reference the field you want to tab to, not the field you're currently in. Also, make sure you have JavaScript selected as the Language.



Regards,

Dave

Avatar

Former Community Member
Ah! Now I understand, Dave.



Many thanks



Benoit