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

How do I control Subforms based on two Presence states

Gillian
Registered: Jul 10 2007
Posts: 63
Answered

Typically I have a form with one button. If pressed, the subform is either hidden or visible.
 
Now my boss wants a form where if radio button A and radio button B are selected, X subform is visible. If radio button A and radio button C are selected, Y subform is visible. How do I write the code for that?
 
Thanks
Gillian

-Gillian

My Product Information:
LiveCycle Designer, Windows
SLDC
Registered: Oct 25 2010
Posts: 70
I'm assuming that A-C are three different sets of radio buttons (because by definition you can only choose one option in a single set of radio buttons).

In the Exit event for radio button B, put a test of whether C is selected, and base the visibility of X on that. In the Exit event for C, put a test of whether B is selected, and base the visibility of Y on that. Something like this ought to work:

// for Radio Button Set B
if(this.rawValue=1) {
if(RadioButtonC.rawValue=0) {
Subform_X.presence = "visible";
}
// There's no "else" condition for either If statement, because you haven't specified what
// needs to happen if both B and C are selected
}

// for Radio Button Set C
if(this.rawValue=1) {
if(RadioButtonB.rawValue=0) {
Subform_Y.presence = "visible";
}
}

Gillian
Registered: Jul 10 2007
Posts: 63
Here's what I tried but it didn't work, with an explanation.

//What I am saying below is that when the routing radio button is set to expedite (2), and the CustApproval radio button is set to No (2), the FastTrak subform is visible and the ECOSigsFull subform is hidden. Since the two subforms sit on the same real estate, only when can be visible at a time.

if(this.rawValue = 2) {
if(form1.Page1.CustApproval.rawValue = 2) {
FastTrak.presence = "visible" {
ECOSigsFull.presence = "hidden" ;
}
}

// What I am saying below is that when the routing radio button is set to standard(1), and the CustApproval radio button is set to Yes (1), the FastTrak subform is hidden and the ECOSigsFull subform is visible.


if(this.rawValue = 2) {
if(form1.Page1.CustApproval.rawValue = 1) {
FastTrak.presence = "hidden" {
ECOSigsFull.presence = "visible";
}
}

.

So what is the proper script for all of this? Also, why do you think this occurs on an exit event instead of a click event?

-Gillian

SLDC
Registered: Oct 25 2010
Posts: 70
Accepted Answer
Click events are for buttons.

I think your script isn't working because you're using a single equals sign in your If statements.
To indicate equivalency, use == (double equals sign); to set a value, use = (single equals sign).

Thus:

if(this.rawValue == 2) {
... etc ...
}

Also, you have three open braces - { - and only two close braces - }.
You don't need the third opening brace.
Gillian
Registered: Jul 10 2007
Posts: 63
Thanks for your help. Really appreciate it.

-Gillian