Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Looking for an IF statement


Not applicable
Hello All,

I'm not very good with javascript at all and I have to thank everyone on the forums that have been helping me with my needs. yet here is another one.,,,,,I'm looking for a statement that will make a field appear after a button is pressed. Any ideas? i've been on this one for a week.

Thanks for all your help in advance
0 Replies


Level 5
Set the field's presence to invisible or hidden (invisible will keep the layout, hidden will move things if your subform is flowable) to start.<br /><br />Then in the click event of the button use...<br /><br /><fieldname>.presence = "visible";<br /><br />If you need to programatically make the field invisible again somewhere else, you can use the same statement. Presence can be visible, invisible, or hidden.<br /><br />Hope this helps!


Level 10
Fieldname.presence = "visible" on the click event of the button.

Note that the form must be sved as dynamic for this to work.


Not applicable
Thanks for your help, its appreciated so much, I'm going to work on that right now. What do you mean by save as dynamic?

Thansk again 🙂


Not applicable
OK I have been trying for a little bit now and still not getting this to work for me. I put this in and its not taking. Any Suggestions? I know somethings wrong in there, just can't find it.<br /><br />if <button3>.event activity="click" then<br /><Imagefield1>.presence="visible"<br />else <br /><Imagefield1>.presence="hidden"<br />endif<br /><br />Thanks again Lucy<br /><br />P.S. I figured out the dynamic thing but still havn't a clue what the difference is.


Not applicable

Select the button and go to the script viewer. Choose the click event from the dropdown box. Remember to choose javascript. Let's say the field name is ImageField1. Add the following code:

ImageField1.presence = "visible"

Also, you have to set the Image field to hidden or invisible as standard for this to work.

By the way, scripts make a pdf dynamic, so you need to save as dynamic pdf to make the script run.


Not applicable
Thanks I added that to the ImageField1. But I still need it to trigger something. Maybe I am confusing everyone becasue i have not many clues ova here can't say no clue. LOL.

I have a button (plain button no action)I want it to do the following when clicked:

1. populate a picture (has to populate first)

2. Send an E-mail out with the form attached showing signature.

I thaught about changing it up: a Radio button Yes or no but I need the same action to take place.

What you gave me above is only part of what I need (I think)

Any more suggestions,.


Level 10
To be able to dynamically populate a picture is against the security in Acrobat (you canot do something that the user does not know you are goinng to do). You can have them choose a picture to put in the image field (by having them select the image they are making the choice themselves). Is this a viable solution?

Conversely if the form is loaded and the picture is already in the form, that is OK. You can make the picture visible/invisible as required.

Can you tell us which way you want to solve this and then I can suggest an approach.


Not applicable
I can't have them load the picture themselves.

Can I have the picture invisible on the form until the button is clicked. at the click of the button 2 things happen. 1. The picture becomes visible 2. The form is sent as a pdf to an e-mail address.

I can switch it to a radio button also but when yes is selected I need the picture to become visible.

Any ideas? or can I even do it.


Level 10
Yes you can make it visible if it is already there. You will have to make your form dynamic and set the image as invisible to start. Then on the event that you want to trigger the change use this code:

imagename.presence = "visible";


Not applicable
i got it!!!! 🙂 🙂 🙂 I'm so form is great. Thank you all! now onto the next adventure.

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now