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

Javascript Question

DJMP
Registered: Nov 14 2007
Posts: 5

I'm trying to make a shopping list. One page one i have fields text1-text50. On the other pages i have grocerie items. Corn, beef, cheese, cereal, etc. when one of the grocerie checkboxes is clicked i want the field text1 to populate no matter which check box is checked. When another checkbox is clicked i want it to automaticaly fill the field Text2. People will be checking the checkboxes in a random order and not always using all 50 text boxes. But i want the text boxes to fill in order. Any help? i don't know much about scripting but i know how to use them. I am using the acrobat form tools with version 7 pro.
 
Dave

My Product Information:
Acrobat Pro 7.0.9, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This isn't a simple one. First, a count could be used to keep track of how many text boxes have been filled in. And since the check boxes will need to fill in the next text box, based on the count, the code will need to auto-generate the text box names. So the text boxes need to be named appropiatley, EX: text1,text2

The general strategy is to create a document level function that keeps the count and fills in the text fields, so all the functionality and state data are in one place. This function is then called from the Mouse Up event of each checkbox.

Of course the big problem is how you handle the user unchecking a check box. This could require a much more complex strategy for an AcroForm. It might be easier to use a dynamic LiveCycle form. Create a new next text field everytime a checkbox is clicked, then delete the text field if the checkbox is unclicked.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script