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

SOLVED

Hidden Field button

Avatar

Level 2

i have a button that when you click on it the hidden fields appear for the user to fill out (Thanks Steve for helping me out with that.)  is there a way when you click on the button again the fields hide again?  here is what i have in the java script for the button

form1.page1.Ambulance2::click - (JavaScript, client)

form1.page1.ambulance_2.presence

= "visible";

form1.page1.patient_2.presence

= "visible";

Thanks for the help

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi,

In the click event of the button you can first check the visibility of the fields first. If the fields are invisible then make it visible and if the fields are visible then make it hidden. For ex : You can try the following script.

form1.page1.Ambulance2::click - (JavaScript, client)

if(form1.page1.ambulance_2.presence == "hidden"  && form1.page1.patient_2.presence == "hidden" )

  {

      form1.page1.ambulance_2.presence = "visible";

      form1.page1.patient_2.presence = "visible";

}

else

  {

       form1.page1.ambulance_2.presence = "hidden";

      form1.page1.patient_2.presence = "hidden";

  }

In addition to it in the docReady event of ambulance_2 and patient_2 add this script : this.presence = "hidden";

Here is a link to a sample form. https://acrobat.com/#d=n4UdzlyPX-jBZOEyCVB5iw

Initially the fields are hidden. Once you click the button the fields will be visible if you again click it then fields will be hidden.

Thanks.

Bibhu.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 9

Hi,

In the click event of the button you can first check the visibility of the fields first. If the fields are invisible then make it visible and if the fields are visible then make it hidden. For ex : You can try the following script.

form1.page1.Ambulance2::click - (JavaScript, client)

if(form1.page1.ambulance_2.presence == "hidden"  && form1.page1.patient_2.presence == "hidden" )

  {

      form1.page1.ambulance_2.presence = "visible";

      form1.page1.patient_2.presence = "visible";

}

else

  {

       form1.page1.ambulance_2.presence = "hidden";

      form1.page1.patient_2.presence = "hidden";

  }

In addition to it in the docReady event of ambulance_2 and patient_2 add this script : this.presence = "hidden";

Here is a link to a sample form. https://acrobat.com/#d=n4UdzlyPX-jBZOEyCVB5iw

Initially the fields are hidden. Once you click the button the fields will be visible if you again click it then fields will be hidden.

Thanks.

Bibhu.