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

Form Fields

mrsneely77
Registered: Sep 3 2008
Posts: 24

Is there some kind of javascript that can be written so that after filling in some information on a form you can possibly hit enter/return and it can jump/skip the next 20 form fields to get to the end of a table to perform the calculation?
The calculation I have used works just fine but my customers don't want to have to keep tabbing through endless form fields once they have already entered all the information they have.
I hope my question is making sense. I would appreciate a quick response.
Also, I am extremely new to Acrobat Javascript so I will need it explained to me clearly and how, if this is possible.

I am a Forms and Records Analyst for the Washington State Department of Retirement Systems. This position in new to the agency so I am setting the standards.

My Product Information:
Acrobat Pro 8.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Read this for information on setting up calculations: http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/form_calculations/

There is also some information in Acrobat help document.

When you set up a calculated field, its value will get recalculated whenever any field value in the form changes, so it will behave as you describe.

If you need help with a particular calculation, post again and give lot of details.

George
mrsneely77
Registered: Sep 3 2008
Posts: 24
My issue is not with the calculation itself, my issue is that I have a table and after the user has entered all the information they have there are still 20 plus fields they can still input information into. They don't want to keep tabbing through all the fields in the table. They want to be able to skip those fields and quickly get down to the last field in the table. Time is of the importance to them and they don't want to have to keep going between the mouse and the keyboard. They want an easy way to get to the bottom of the table. Is there some kind of javascript that can be written to that maybe when they hit the enter button on the keyboard it will skip the rest of the fields and get them to the last field in the table?

I am a Forms and Records Analyst for the Washington State Department of Retirement Systems. This position in new to the agency so I am setting the standards.

Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi mrsneely77,

Will all users be able to skip those 20 extra fields or will some need them and some not ( variable input data for different users)? If some people are done at field #12 while others fill in data up to field #20, you could place a button at the end of each section to skip to the bottom of the page and leave it up to the user to hit that button.

Easiest of course is for them to use the mouse just once and scroll to the end when they are done tabbing, unless the tabbing is required for Acessibility reasons.

If you want really clear, good instructions on using Acrobat JavaScript you can find a full course on-line at www.pdfscripting.com

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
If you want to use the Enter key to cause the focus to shift to a field, you could do something like the following in the Format event of each of the fields in the table:

// If the user pressed Enter (Return), to commit the new field value,// set the focus to "button1"if (event.commitKey === 2) getField("button1").setFocus();

You could also use the "modifier" and "shift" event properties to something similar. With the "modifier" property you can determine if the Ctrl key is pressed, and the "shift" property tells you if the Shift key is pressed.

George
mrsneely77
Registered: Sep 3 2008
Posts: 24
When I tried the JavaScript you suggested (changing "button1" to what the what I labeled the field) I get this message in the JavaScript Debugger.

Acrobat Multimedia Version 8.0
Acrobat SOAP 8.0

unterminated string literal
3:
unterminated string literal
3:
missing ; before statement
1:

What am I doing wrong?

I am a Forms and Records Analyst for the Washington State Department of Retirement Systems. This position in new to the agency so I am setting the standards.

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You probably left off one of the quote characters around the field name. If you post the exact code you're using, we could tell for sure what's wrong.
mrsneely77
Registered: Sep 3 2008
Posts: 24
You must have been right, since I tried it again and I did not receive the JavaScript Debugger error. However, the script did not work. Oh well, at this time I guess I will need to let my customer know they will have to continue to tab through the rest of the fields to get to the end of the table. It will be very time consuming for them since there are at least 20 to 50 fields till the end of the table.

I am a Forms and Records Analyst for the Washington State Department of Retirement Systems. This position in new to the agency so I am setting the standards.

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
It does work if the field value is changed by the user and the user commits the new value by pressing the Enter (Return) key. In case it wasn't clear, the script would have to be placed as a custom Format script for each text field you want to behave this way.
mrsneely77
Registered: Sep 3 2008
Posts: 24
I don't know what I am doing wrong, because when I test it, it doesn't work for me.

I changed the value in the field, pressed enter but I didn't jump from that field to the last field in the table like I was wanting.

I am a Forms and Records Analyst for the Washington State Department of Retirement Systems. This position in new to the agency so I am setting the standards.