Skip to main content
Participant
Dec 13, 2016 3:48 AM UTC
Question

Image with Drop down in Adobe Acrobat X pro

Greetings all,

I am new to the JavaScript Adobe Acrobat Form and trying to create a form here with the images and a drop down box.

I use button command to place an image in it where I would like to have my image to appear when one of the option from the drop down box is selected:

When Option 1 is selected, image 1 (button) will be visible, image 2 & 3 are invisible

When Option 2 is selected, image 2 (button) will be visible, image 1 & 3 are invisible

When Option 3 is selected, image 3 (button) will be visible, image 1 & 2 are invisible

Otherwise all the images will be invisible

How do I start or write a full JavaScript with the above condition as mention?

Thank You.

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Inspiring
Dec 13, 2016 5:26 AM UTC

The custom validation script of the dropdown could be:

(function () {

    // Get references to the image buttons

    var f1 = getField("image1");

    var f2 = getField("image2");

    var f3 = getField("image3");

    // Hide all of the images

    f1.display = display.hidden;

    f2.display = display.hidden;

    f3.display = display.hidden;

    // Show an image based on the selection

    switch (event.value) {

    case "Option 1" :

        f1.display = display.visible;

        break;

    case "Option 2" :

        f2.display = display.visible;

        break;

    case "Option 3" :

        f2.display = display.visible;

        break;

    }

})();

You may need to change the field names or the dropdown values I assumed, but it should get you started.

Translate
PYZAuthor
Participant
Dec 13, 2016 6:02 AM UTC

Hi George,

I use your script, change field names and dropdown values but the the image didn't become visible when I select the option.

All the images are hidden and it doesn't show any errors for the script.

Please advise.

Translate
try67
Community Expert
Community Expert
Dec 13, 2016 9:33 AM UTC

Check the JS Console (Ctrl+J) for any error messages.

Translate