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

Javascript for Checkboxes

publicdebter
Registered: Feb 20 2008
Posts: 18

I am new to LCD.

I have created a dynamic interactive form that has checkboxes which enables subforms to appear upon the "click" event.

However, I need for the subforms to disappear when their corresponding checkboxes are unchecked.

I believe I need to assign a value to the checkbox, and have specific Javascript cause the subforms to be hidden from the layout through some sort of "if" "then" command.

Any assistance would be greatly appreciated! Thank you!

My Product Information:
LiveCycle Designer, Windows
tonyalt3
Registered: Jul 9 2008
Posts: 22
I apologize, but I don't have an answer to your question. However, I was wondering if you could share the javascript you used to have subforms appear when a check box is checked? Thanks in advance
koenigma
Registered: Jan 23 2008
Posts: 45
I have 2 radio buttons grouped named "rdo Scope" with the caption Yes(1) & No(2)Below is the FormCalc to hide or display a Page called "SupplementPg" in my Form:

Select the Yes radio button abd place the following in the Script Window under "Initialize"

if (rdoScope.#field[0].rawValue == 1) then
SupplementPg.presence = "visible"
else
SupplementPg.presence = "hidden"
endif

Select "No" and this is placed under "Change"

if (rdoScope.#field[1].rawValue == 2) then
SupplementPg.presence = "hidden"
else
SupplementPg.presence = "visible"
endif

Hope this is of help
goodbye
Registered: Jul 7 2008
Posts: 49
in addition to koenigma's suggestion (which is correct), if you wanted to just stay with a single check box, you would do the same thing.

Place a checkbox on your form and then a text field, wrap the text field (or whatever you are showing/hiding) in a subform.

On docReady, hide the subform:

form1.#subform[0].mySubForm::docReady - (JavaScript, client)
this.presence = "hidden";

and on change for the check box:

form1.#subform[0].myCheck::change - (JavaScript, client)

if (this.rawValue == "1") {
mySubForm.presence = "visible";
}
else {
mySubForm.presence = "hidden";

}

this will toggle the subform's visibility. If you need to allow the user to be able to open, work, close, and then reopen the form, then you will need to check to see if the check box was clicked so that the subform is visible when they reopen the form.

you would put the same code in the docReady event to see if the value of the checkbox was "1"