These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Move to next field when populated

craig.copley
Registered: Mar 8 2010
Posts: 4
Answered

Hi all,

I am trying to develop a form that when you enter data into a field it then moves to the next field when you have entered the required digits.

Any ideas?

Thanks

Craig

My Product Information:
Acrobat Pro Extended 9.1.3, Windows
jimhealy
Team
Registered: Jan 2 2006
Posts: 146
There is no function that sets the focus to the next field, so the only way to do this would be to build an array of field names in order of focus. Then you can use the Keystroke event to detect when the full length of text you wanted is in the field, then call setFocus on the next field in the array (you can lookup the name of the current field using event.target.name and then look it up in your array and then find the name of the field for the next focus).

Good Luck,
Jim Healy
FormRouter, Inc.
Check out our FREE Advanced Acroform Toolset:
http://www.formrouter.com/tools

Jim Healy, Founder & CEO FormRouter Inc.
Chapter Leader AUG RTP NC
http://www.formrouter.com

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Did you create the forms in Acrobat or LiveCycle Designer?

For Acrobat forms there is user entered document level function that can provide this feater. It will require that the form fields that will use this feature have a maximum filed size limit set, and a custom keystroke script be used to test the input and the length of the entered data.

More information can be found in [url=http://www.planetpdf.com/developer/article.asp?ContentID=javascript_setfocus_method_f&gid=6267]JavaScript - setFocus Method for tabbing to next form field[/url].The example is for numeric data input, but it easily modified to be able to test for alphabetic or alpha numeric input. You will note that one needs to provide the document object, event object, and the name of the field to tab to when the field is filled. Note that because you are providing the field name for the next field, you do not need the fields in an array, look at the 'SSN.2' filed for an example of moving to a field that is not apart of the hierarchical field 'SSN'.

George Kaiser

jimhealy
Team
Registered: Jan 2 2006
Posts: 146
Good example. I guess I shouldn't have said "the only way", but this was the basic idea. I think the advantage of using the array would be that all the keystroke scripts would be exactly the same (and then you could add them all via script which would be a lot faster than using the properties dialog). The disadvantage might be maintaining the array.

Jim Healy
FormRouter, Inc.
Check out our FREE Advanced Acroform Toolset:
http://www.formrouter.com/tools

Jim Healy, Founder & CEO FormRouter Inc.
Chapter Leader AUG RTP NC
http://www.formrouter.com

craig.copley
Registered: Mar 8 2010
Posts: 4
This example works exactly how I wanted. But in making the custom format with the autotab function, it still does not work in my file. Is there some properties that I have to endable, or a setting somewhere I have to change?
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Are you getting any errors in the JavaScript debugging console?

Did you include the document level function from the example in your PDF?
function AutoTab(doc, event, cNext){// Call the built-in routine to allow numbers only.AFNumber_Keystroke(0, 0, 0, 0, "", true);// If we've filled in the field completely, jump to the next one.if (event.rc && AFMergeChange(event).length == event.target.charLimit)doc.getField(cNext).setFocus();}

Did you fill in the parameters when calling the function to include the changing the field name for the next field (cNext)?

Note, this code only works for numeric data. The call to function 'AFNumber_Keystroke' performs the number check and the result of that check (event.rc) along with a check of the number of characters entered to the character limit of the field to determine if the form field has been filled or not.

George Kaiser

jimhealy
Team
Registered: Jan 2 2006
Posts: 146
Also, did you set "Limit of x characters" in the property Options on all of the fields involved?

Jim Healy
FormRouter, Inc.
Check out our FREE Advanced Acroform Toolset:
http://www.formrouter.com/tools

Jim Healy, Founder & CEO FormRouter Inc.
Chapter Leader AUG RTP NC
http://www.formrouter.com

craig.copley
Registered: Mar 8 2010
Posts: 4
Thanks for all your help guys.
New at this and am missing the simplist items

Thanks again