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

dynamically show/hide fields based on combo box value

singb
Registered: Dec 14 2009
Posts: 6

Hi,

Im hoping that someone might be able to help me figure out this problem Im having. Im using acrobat 9 Pro on a PC.

Im trying to figure out how to show a specific number of text fields after the user makes a selection using a combo box.

The combo box is named "Combo1" and has 41 items (01-41) with each having the corresponding export value (04=4, 30=30, etc).

The text fields are named "affected1", "affected2", etc. and are hidden on the form opening.

I've been trying to figure out how to write the javascript so that when the user chooses a number (1-41) in the combo box, the corresponding number of text fields become visible on the form. ie. if the user picks "04" in the combo box, fields "affected1", "affected2", "affected3", "affected4" become visible.

The other thing that I need to do is validate that the text fields (affected1, etc) that become visible are filled out by the user using a 8 digit long entry, ie. 12345678

Im new to javascript and have been able to find code within these forums to get myself far enough but am unsure how to proceed now. If anyone could help that would be great.
Thanks

My Product Information:
Acrobat Pro 9.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
So you only want to show those fields if they have a value of 8 digits? If so, you can use this:

var patt=/^[0-9]{8}$/;var result=patt.test(str);

If str holds the value of the field, result will tell you if it's made out of exactly 8 digits.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com