Is there a way to control the focus when a form is displayed?

hdouglas

Member
I have a multi page form with some repeat groups. As you move forward through the form, when a new group (page) is displayed the browser focus jumps to the Next button.

Is there a way to force it to a particular element?
 
Not entirely trivial, but should be possible to accomplish with some jQuery in form_XX.js

As the page is divided into div's with id's starting page_0, page_1 etc., you can add the following actions to "Next" and Previous" buttons click events:

1) Loop through divs where the id contains "page_" with jQuery each function.
2) Check which one does not have "display:none" applied and focus the right "first" element with jQuery('#your-elemenr-ID').focus(); accordingly.
 
many thanks, I have managed to find a work around by carefully constructing the fields and where they are very long calc elements, using a checkbox to hide/reveal where the default is hide. This gives the user the choice and maintains the form in a more viewable state. I like your suggestion though and will give it a try, thank you.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top