Skip to main content
Participant
December 13, 2016
Question

Image with Drop down in Adobe Acrobat X pro

  • December 13, 2016
  • 1 reply
  • 2875 views

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 has been closed for replies.

1 reply

Inspiring
December 13, 2016

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.

PYZAuthor
Participant
December 13, 2016

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.

try67
Community Expert
Community Expert
December 13, 2016

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