Copy link to clipboard
Copied
The standard selection is to select Sets, however Form must be able to handle when a Customer only wants one piece of a set. So when Pieces is selected in the drop down, I have 2 mutually exclusive Check Boxes that turn on. However dependent on which check box is selected I need each check box to have independent code from each other. The code will open certain fields to complete and hide others. The code is nearly reversible between the two. Can this be done by testing for the export value of the check box? If yes how do I code?
Copy link to clipboard
Copied
Okay, perhaps I interpreted the term "mutually exclusive" differently than you meant it, but in any case, 2 (or any number of) checkboxes with the same name are not functioning as checkboxes, but as radio buttons. (Simply put, they can't be selected simultaneously; selecting one de-selects the other, right? This is ostensibly what you meant by 'mutually exclusive.')
So here it is, altered for that scenario (2 checkboxes, named identically, one with an export value of yes, the other with a value of no):
var cbox = this.getField("2checkboxes");
if (cbox.value == "yes")
{
// Show the relevant fields
this.getField("field1").display = display.visible;
this.getField("field2").display = display.visible;
this.getField("field3").display = display.visible;
// Hide the irrelevant fields
this.getField("field4").display = display.hidden;
this.getField("field5").display = display.hidden;
this.getField("field6").display = display.hidden;
}
if (cbox.value == "no")
{
// Show the relevant fields
this.getField("field4").display = display.visible;
this.getField("field5").display = display.visible;
this.getField("field6").display = display.visible;
// Hide the irrelevant fields
this.getField("field1").display = display.hidden;
this.getField("field2").display = display.hidden;
this.getField("field3").display = display.hidden;
}
Copy link to clipboard
Copied
Here some simple example code:
var cbox1 = this.getField("checkbox1");
var cbox2 = this.getField("checkbox2");
if (cbox1.value == "exportvalue")
{
// Show the relevant fields
this.getField("field1").display = display.visible;
this.getField("field2").display = display.visible;
this.getField("field3").display = display.visible;
// Hide the irrelevant fields
this.getField("field4").display = display.hidden;
this.getField("field5").display = display.hidden;
this.getField("field6").display = display.hidden;
}
if (cbox2.value == "exportvalue")
{
// Show the relevant fields
this.getField("field4").display = display.visible;
this.getField("field5").display = display.visible;
this.getField("field6").display = display.visible;
// Hide the irrelevant fields
this.getField("field1").display = display.hidden;
this.getField("field2").display = display.hidden;
this.getField("field3").display = display.hidden;
}
Copy link to clipboard
Copied
When I make the 2 Checkboxes mutually exclusive they have the same name, so how do I reference the Check Box to setup the variables as you show below?
Tom
Copy link to clipboard
Copied
Okay, perhaps I interpreted the term "mutually exclusive" differently than you meant it, but in any case, 2 (or any number of) checkboxes with the same name are not functioning as checkboxes, but as radio buttons. (Simply put, they can't be selected simultaneously; selecting one de-selects the other, right? This is ostensibly what you meant by 'mutually exclusive.')
So here it is, altered for that scenario (2 checkboxes, named identically, one with an export value of yes, the other with a value of no):
var cbox = this.getField("2checkboxes");
if (cbox.value == "yes")
{
// Show the relevant fields
this.getField("field1").display = display.visible;
this.getField("field2").display = display.visible;
this.getField("field3").display = display.visible;
// Hide the irrelevant fields
this.getField("field4").display = display.hidden;
this.getField("field5").display = display.hidden;
this.getField("field6").display = display.hidden;
}
if (cbox.value == "no")
{
// Show the relevant fields
this.getField("field4").display = display.visible;
this.getField("field5").display = display.visible;
this.getField("field6").display = display.visible;
// Hide the irrelevant fields
this.getField("field1").display = display.hidden;
this.getField("field2").display = display.hidden;
this.getField("field3").display = display.hidden;
}
Copy link to clipboard
Copied
Yes, thanks that’s what I needed.
Tom
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more