Copy link to clipboard
Copied
Hi.
I have the below scenario, whereby there are two checkbox options and if yes is selected for either of them, then they need to provide details in the text field, even if no is selected in one but yes is selected in the other I need the text field to be visible, but if no is selected for both then the text fields should be hidden
I currently have this script (or something similar) in all of the checkboxes:
// fields to show and hide
var field1 = this.getField("Specify any restrictions etc and/or failure to comply with restrictions etc 1");
var field2 = this.getField("Specify any restrictions etc and/or failure to comply with restrictions etc 2");
// check box that changes visibility
if (this.getField("Check Box49").value == "Yes")
{
//hide these fields
field1.display = display.visible;
field2.display = display.visible;
}
else
{
// show these fields
field1.display = display.visible;
field2.display = display.visible;
}
This works if they select no for the first option and yes for the second. But, if they select yes for the first option and no for the second, it removes the text fields.
I'm just learning scripts in Adobe pro DC so I'd really appreciate any help I can get.
thanks
Leah
Hi!
I would do it using this code as the custom calculation script of the first text field:
var field1 = event.target;
var field2 = this.getField("Specify any restrictions etc and/or failure to comply with restrictions etc 2");
var showFields = (this.getField("Check Box49").valueAsString=="Yes" || this.getField("Check Box50").valueAsString=="Yes");
field1.display = (showFields ? display.visible : display.hidden);
field2.display = (showFields ? display.visible : display.hidden);
Copy link to clipboard
Copied
What are the names of both check-box groups?
Copy link to clipboard
Copied
Hi try67
The first checkbox is called "Check Box49" and second one is called "Check Box50"
Thanks
Leah
Copy link to clipboard
Copied
Hi!
I would do it using this code as the custom calculation script of the first text field:
var field1 = event.target;
var field2 = this.getField("Specify any restrictions etc and/or failure to comply with restrictions etc 2");
var showFields = (this.getField("Check Box49").valueAsString=="Yes" || this.getField("Check Box50").valueAsString=="Yes");
field1.display = (showFields ? display.visible : display.hidden);
field2.display = (showFields ? display.visible : display.hidden);
Copy link to clipboard
Copied
thank you so much try67
just to confirm, does that go into the custom format script or custom keystroke script (or both) or somewhere else.
I have tried it in both script fields and it is hiding the text fields straight away instead of when clicking on the checkboxes.
thanks
Leah
Copy link to clipboard
Copied
Neither. It's a custom calculation script, as I wrote.
Copy link to clipboard
Copied
thank you try67
As I wrote, I'm very new to this. I have googled it and found how to do a calculation script
thank you for your assistance