Expand my Community achievements bar.

How to add javascript nextField function?

Avatar

Former Community Member

I have a very complicated form which is being used as an OCR (optical character recongition) when printed. I have individual fields which needs to be user-friendly. I want to be able to use livecycle designer because of it's ease although I can't seem to find a way to add the javascript I use in Acrobat Pro. The individual boxes need to advance to next field after the user types in their info. Can anyone help me add the 'nextField' inside my livecycle designer document? I like using Acrobat Pro but I am having issues with the 300+ fields shifting; I have to manually move each field to the correct position.

Thanks in advance.pdf.jpg

5 Replies

Avatar

Level 2

Hi,

Would a setFocus help? Assuming you know how to add JavaScript to a field I used the Change event to move to the next field. Once an entry was made in my first field, which I had restricted to one character, the focus moved to the next field. This allowed to type into each field without having to Tab or press Enter.

I inserted TextField1, TextField2, TextField3. On TextField1 I put the following JavaScript on the Change event of TextField1 to make it go to TextField2 after I had typed: "xfa.host.setFocus(TextField2)". You should be able to see it in the image below.

Good luck,

Greig

2012-10-30_123112.jpg

Avatar

Former Community Member

How do you add the javascript to the fields or document? Thanks so much for replying.

Avatar

Level 2

Open your form in Livecycle Designer. Click on your field and go to Window > Script Editor to turn it on. From there you have a range of JavaScript and FormCalc options available to you.

Good luck.

Avatar

Former Community Member

Thanks Greig! I am currently having other problems with the program (runtime error) but will try this once this is fixed LOL.