Copy link to clipboard
Copied
Looking for some assistance with a PDF. I have two images that I need to display based on a value in another field. If the value of field A is X then show image 1 is field is Y then show image 2. Is this possible?
Use something like this as the custom validation script of the text field:
var b = event.value.indexOf("Voice")==0;
this.getField("Image1").display = b ? display.visible : display.hidden;
this.getField("Image2").display = !b ? display.visible : display.hidden;
Copy link to clipboard
Copied
Yes, this is possible. Place the images as the icons of button fields and then show/hide those fields based on the value of field A.
Copy link to clipboard
Copied
Thanks I will give it a try.
Copy link to clipboard
Copied
I do not see where you can show or hide the buttons based on the value of the field? I do see the Actions but it looks they require a interaction with the field to execute and there is nothing related to the field value?
Copy link to clipboard
Copied
You would need to use a script, attached to the field. If you describe what
kind of field it is and what value should cause an image to appear or
disappear, I can help you with the actual code.
On Wed, Sep 27, 2017 at 4:29 PM, garabedy83334101 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
That would be great! It is a text field that can have several values. If the value in the text field starts with a Voice then it would show image A anything else would show image B. Is that possible
Copy link to clipboard
Copied
Sure. What if the text field is empty, though?
Copy link to clipboard
Copied
Show image B
Copy link to clipboard
Copied
Use something like this as the custom validation script of the text field:
var b = event.value.indexOf("Voice")==0;
this.getField("Image1").display = b ? display.visible : display.hidden;
this.getField("Image2").display = !b ? display.visible : display.hidden;
Copy link to clipboard
Copied
Thank you I will give it a try.
Copy link to clipboard
Copied
Does not seem to do anything. On the text field I selected Run custom validation script with the following.
var b = event.value.indexOf("Voice")==0;
this.getField("Image3_af_im").display = b ? display.visible : display.hidden;
this.getField("Image4_af_im").display = !b ? display.visible : display.hidden;
Copy link to clipboard
Copied
Change the value of the field for it to kick in, and check the JS-Console (Ctrl+J) for error messages.
If there are none and it still doesn't work, share the file and I'll check what's going on.
Copy link to clipboard
Copied
I created a fresh form and now it works. Thanks for your help !