I am VERY new to Acrobat and need some help with the following.
I have created a form with the help of your article titled " Changing Another field with Combo Box Selection"
My form consists of 10 dropdown combo Boxes all containing a list of product codes. When I chose a product code from the list, I need the corresponding product name to automatically prepupolate in a text field underneath it. I was able to accomplish this for the first dropdown box by using the sript sample provided in the article but I am unable to make it work for the other dropdown boxes.
Here is an example of my form: I have a Combo Box labeled "Product Code.0.0" that has a list of product codes. I then have several other Combo Boxes labeled "Product Code.0.1, Product Code.0.2 and so on(all boxes have the same dropdown list items).
Then I have a Text Box underneath each Combo Box labeled "Product Name.0.0, ProductName.0.1 etc. that I need prepopulated when I chose an item in the combo box above.
How do I make the first Combo Box and Text Box work indenpendently of the next set of Combo/Text Boxes?
[url=http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/string_splitting/]http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/string_splitting/[/url]
However since you're only dealing with one text field there is a much easier way. Just pass the text field name into the function that does the prepopulation. So your custom keystroke event will look like this.
A couple of other things. It really is better to use the string manipulation to automatically create the field names. For the easy method I've outlined above the code in each combobox is different by one thing, the name of the field to be populated. In the automated method the code is exactly the same everywhere. The only difference the in the name of the fields themselves. This make for more robust and easier to maintain code. And another thing, the code in the article was written to be easy to follow. A much better design would be to put a single function call into the Keystroke event of the combobox. This way all the code is in a single location. You can change how all the comboboxes work by only changing code in a single location. The trick to doing this is called abstraction. You have to be able to generalize the code to work with any comboboxes by using it's name. This is kind of an advanced thing.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script