Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Looking for an IF statement

Avatar

Former Community Member
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
10 Replies

Avatar

Former Community Member
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!

Avatar

Former Community Member
Fieldname.presence = "visible" on the click event of the button.



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

Avatar

Former Community Member
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 :-)

Avatar

Former Community Member
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.

Avatar

Former Community Member
Hi,

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.

Avatar

Former Community Member
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,.

Avatar

Former Community Member
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.

Avatar

Former Community Member
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.

Avatar

Former Community Member
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";

Avatar

Former Community Member
i got it!!!! :-) :-) :-) I'm so happy...my form is great. Thank you all! now onto the next adventure.