Expand my Community achievements bar.

Hide/Show Presence setting

Avatar

Former Community Member
I am attempting to use javascript to hide/show items when I button is pressed. If the items are set to visible in the design view the script to hide/show works fine, but if I set the presence property to invisible or hidden from design view, the script will not override that and make the items visible. Has anyone come across this before? Below is a copy of the script I've been using.



7 Replies

Avatar

Former Community Member
Hi,



I think you must try "hidden" and not "invisible".

Avatar

Former Community Member
I have tried both Hidden and Invisible from design view and both cause the script not to function. If the presence is set to visible from the design view both "hidden" and "invisible" work fine in the script.

Avatar

Former Community Member
Both hidden and invisible are valid values. Invisible will leave the object on the form (just make it invisible to the user). Hidden will remove it from th elayout so no reference to the object is available.



I think your issue is that you are not displaying the form as a dynamic form. If you are using Preview to test the form, go under File/Form Properties and click on the preview tab. Make suer the form is set as an Interactive form and the Preview Adobe XML Form as is set to Dynamic XML Form

Avatar

Former Community Member
Thanks for the suggestions, still no luck though, I am trying to use the feature to swap two subforms on a page so that when a button is pressed one subform becomes hidden and the other form becomes visible. I have verified that the form is saved as a dynamic form.



Ive tried page1.presence = hidden, form1.page1.presence = hidden, and this.presence = hidden.



Any ideas?

Avatar

Former Community Member
The hidden is a string so it must be in quotes...."hidden"

Avatar

Former Community Member
Sorry, poor typing on my part. I think i figured it out though, i had the button to switch forms on one of the subforms. When i moved the button off the subform and on to the main form it seems to be working now.



Thanks for all the help.

Avatar

Former Community Member
Paul,



Are you using LiveCycle Designer?



If yes, do the following:



1) Save you work as "Adobe Dynamic XML Form".

2) On each of the buttons, do the following:

a) Select the button.

b) Choose "Initialize" in the scripting toolbar. Choose language as "JavaScript".

c) type: ObjectName.presence = "invisible";

3) Then choose the onclick event of your button and type:

ObjectName.presence = "invisible";

or ObjectName.presence = "visible";

depending on your requirement.



Hope it helps :)