How to use a Drop-down list to change Pictures?
Ok I'm going to go right out and say it... jeezzz this is so hard.....Ok just got to let it out...Big deep breath.....Ok to have a Drop Down list select and show a certain graphic within a form requires..............a small amount of programming! Ok, I said it, yes you must write a little code to have it happen for you. Wow, I feel so cleansed! Invigorated even, because if you have the ability to write very basic conditional code, you will be able to get more things done much quicker! I'll get off the soap box now and get on with it. This was a fun little task, because the Acrobat Designer is a very powerful program that allows you to be very flexible with your forms. There is a great resource for the Acrobat Designer Here and Here is a PDF of the Form Calc Users Ref. A must have for form creators! So here you go, I have also attached the finished form here for you to play with; Dropdown to Change Pix.
So let's get started, First open the Adobe LiveCycle Designer (sorry Mac Users you do not have this one, I will show this process for standard Acroforms in a later post) and start a blank form.
Your form should look like this:
- Drag and Drop a Drop-Down List
any where on the page
- Add a Text Field
under the Drop-Down List
- Under the Text Field add 3 Image Fields
(Hint, it is alway a good idea to name your fields)

- Select the Drop-down List you placed on your form
- Goto the Script Editor and select FormCalc as our language (on the right side) and where it says Show
pull down and select Change as the event
- Copy and paste the code below (Note: I changed the name of the image boxes)
// Code written by Tim Huff - Business Development Manager for Acrobat Oct 5 2007
// Populate a variable (sNewValue) with the Current Value of the Drop-down list using the newText event.
var sNewValue = $.boundItem(xfa.event.newText) TextField1.rawValue = sNewValue; // Fill the Text box with what you got
// Test your variable agaist the name of the Image Object. The names for each Image object is listed under the Image
if (sNewValue == "Acrobat Logo") then
//Let's hide the Acrobat Logo
AcrobatLogo.presence = "invisible";
AcrobatPro.presence = "visible";
AcrobatPro.presence = "visible";
elseif (sNewValue == "Acrobat Pro Box") then
//Let's hide the Acrobat Pro Box
AcrobatPro.presence = "invisible";
Acrobat3D.presence = "visible";
AcrobatLogo.presence = "visible";
elseif ( sNewValue == "Acrobat 3D Box") then
//Let's hide the Acrobat 3D Box
Acrobat3D.presence = "invisible";
AcrobatLogo.presence = "visible";
AcrobatPro.presence = "visible";
elseif ( sNewValue == "All") then
// Ok for fun let's hide'em all
Acrobat3D.presence = "invisible";
AcrobatLogo.presence = "invisible";
AcrobatPro.presence = "invisible"; endif
Now you should be able to just click on the Preview PDF tab and run your code.
That was pretty deep for a Monday morning, so have fun, don't get to frustrated, check out the links I set up for you and you can download a version of the form here Form for Drop-down list to change images Have a good week, I am off to the PDF Central Conference, so try to put some life in your life, check out a soccer game on Fox Soccer Channel Let's go FC Dallas! Go Cowboys!
Later all Tim
If electricity comes from electrons, does that mean that morality comes from morons? - Unknown
any where on the page
under the Drop-Down List
(Hint, it is alway a good idea to name your fields)
pull down and select Change as the event