Highlighted

Hide/Show Presence setting

Avatar

09-07-2008

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.



Replies

Highlighted

Avatar

Avatar

_jerome_dinnat_

Avatar

_jerome_dinnat_

_jerome_dinnat_

09-07-2008

Hi,



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

Avatar

09-07-2008

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.
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

10-07-2008

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
Highlighted

Avatar

15-07-2008

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?
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

15-07-2008

The hidden is a string so it must be in quotes...."hidden"
Highlighted

Avatar

16-07-2008

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.
Highlighted

Avatar

18-07-2008

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 🙂