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

Stop tabbing after last field?

ronlg
Registered: Oct 1 2008
Posts: 22

I have about 15 fields, after the last field, I do not want it to tab back to the top (first field).

The last field has some error checking. If it has < 11 characters, it alerts a msgbox to tell the user that they need to enter in more characters. When the user clicks "Ok", that is when it tabs to the next field.

Is there a way to automatically have it keep focus on the field?

Thanks!

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Are you saying that you only need to have the focus remain on the field if the user has not entered the correct number of characters, but otherwise it's OK to move on? In what event (Validate, Keystroke, Format, On Blur, etc.) do you currently have your error checking code?

George
ronlg
Registered: Oct 1 2008
Posts: 22
I have it On Blur... and yes, I want it to keep focus on that text field until the proper value is entered.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
The following is intended to be a Validation script for the field. If this does not give you what you want, explain what you'd like to be different and we may be able to suggest something. Also, get rid of your current On Blur script.

// If there are fewer than 11 characters (but allow none too)if (event.value.length < 11 && event.value.length) { // Alert userapp.alert("Please enter at least eleven characters.", 3); // Return focus to this fieldevent.target.setFocus();}

George
ronlg
Registered: Oct 1 2008
Posts: 22
Great!
Thank you for your help.

Do you have a recommendation for a resource on JavaScript with Acrobat PDFs?



Regards,
Ron
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
The best online resources are this place (see Thom's JavaScript Corner) and now pdfscripting.com, but that's because the same people are responsible. Also, make sure you at least have the Acrobat JavaScript reference and related materials: http://www.adobe.com/devnet/acrobat/javascript.php

George