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

HIdden/Visible box based on answer from Drop-down

saj
Registered: Oct 15 2008
Posts: 52

I am trying to figure out how to create a code so that if a drop-down box answer is one thing, then a button will appear. Can someone point me in the right direction? I am using Acrobat 9 Pro on the Mac.

Here is what I am trying to do:

Dropdown consists of Apple, Oranges and Grapefruit.

If Apples is select from dropdown Button1 will appear.
If Oranges is select from dropdown Button2 will appear.
If Grapefruit is select from dropdown Button2 will appear.

ANY help will be greatly appreciated.

thanks!

My Product Information:
Acrobat Pro 9.2, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2399
In the drop-down box's custom calculation script, you need to look at event.value and based on that set the button's display property.

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

saj
Registered: Oct 15 2008
Posts: 52
thanks, do you know where to find an example of this to analyze?
try67
Expert
Registered: Oct 30 2008
Posts: 2399
I think similar scripts were posted on these forums, but I don't have a concrete example right now.
Basically, it's something like

if (event.value=="apples") {
this.getField("button").display = display.visible;
}
if (event.value=="oranges") {
this.getField("button").display = display.hidden;
}

etc.

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

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Don't use a caculation script. Use an event that is only triggered when a drop-down selection is made. You'll find the relavant info in these articles:

http://www.acrobatusers.com/tutorials/2007/js_list_combo_livecycle/
http://www.acrobatusers.com/tutorials/2006/show_hide_fields

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

saj
Registered: Oct 15 2008
Posts: 52
thank you! thank you! thank you!