These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Checkbox used to show/hide textfield

gdesrosiers
Registered: Jan 21 2008
Posts: 33

I have two problems here. First the idea of what we want to do.

We want to use a checkbox to hide one or more fields if the checkbox is checked. If it is not checked we want the fields to show up.

Now I've seen many solutions on here that are close, but being new at this I do not know where to put these formulas.

Also I see people writing "else" or "then" are these words actually written in the formula or is it like Excel where the words are represented by commas.

Any help would be greatly appreciated.

Gdesrosiers

My Product Information:
LiveCycle Designer, Windows
gdesrosiers
Registered: Jan 21 2008
Posts: 33
Also, the checkboxes we are using are globally set. One when is checked the other isn't. Would this affect the formula?
StevenD
Registered: Oct 6 2006
Posts: 368
The word "else" is used in JavaScripts and "then" must be used in FormCalc. I don't use FormCalc so I am only guessing.

I tried the following script in the Change event of a check box.

if(this.rawValue == "1") //Find out if the check box has been checked.
{
NumericField1.presence = "hidden"; //If it has hide the desired field. You could use "invisible" as well. It depends on what you want to have happen.
}
else
{
NumericField1.presence = "visible"; //If the check box isn't has been unchecked then make the desired field visible.
}

StevenD

StevenD

gdesrosiers
Registered: Jan 21 2008
Posts: 33
Thank you. That worked using the word "invisible".

One more thing I had to reset the checkbox with a different name. I had the Yes and no boxes linked globally. When linked it would make the textfield disappear. However, I could not get the field to come back by clicking on the Yes checkbox. Is there a way to also make the No checkbox change the value of the Yes checkbox without setting to Global?

Thanks Again
Geoff
StevenD
Registered: Oct 6 2006
Posts: 368
I wouldn't use a global setting.

StevenD

gdesrosiers
Registered: Jan 21 2008
Posts: 33
Your right. I went to using the same formula for the Yes box, but reversed. Also set the No box to reset value of Yes box and vice versa. It works great now. Thank you for your help.
gdesrosiers
Registered: Jan 21 2008
Posts: 33
Now we have a new problem with this. When the form is reopened after being filled out and saved. The hidden boxes reappear. Is there a way to keep them from reappearing everytime you open the file?

Thanks
Geoff