Copy link to clipboard
Copied
If have Checkbox1, Text Field1, Text Field2, Text Field3, Text Field4 and Text Field5. I would like to show and hide as follows:
CB1 not checked and TF1 contains no text = show TF2, hide TF3, TF4 and TF5
CB1 not checked and TF1 contains text = show TF3, hide TF2, TF4 and TF5
CB1 checked and TF1 contains text = show TF4, hide TF2, TF3 and TF5
CB1 checked and TF1 contains no text = show TF5, hide TF2, TF3 and TF4
Copy link to clipboard
Copied
In the script provided by JR Boulay it's missing 'C' in each condition
Oops!
It's always better with a test file.
Attached.
var CB1 = this.getField("Checkbox1");
var Tx1 = this.getField("Text Field1");
var B1 = this.getField("Button1");
var B2 = this.getField("Button2");
var B3 = this.getField("Button3");
var B4 = this.getField("Button4");
B1.display = display.hidden;
B2.display = display.hidden;
B3.display = display.hidden;
B4.display = display.hidden;
if (CB1.value === "Off" && Tx1.value === Tx1.defaultValue) {B1.display = display.noPrint;}
else if (CB1.value === "Off" && Tx1.value != Tx1.defaultValue) {B2.display = display.noPrint;}
else if (CB1.value != "Off" && Tx1.value != Tx1.defaultValue) { B3.display = display.noPrint;}
else if (CB1.value != "Off" && Tx1.value === Tx1.defaultValue) {B4.display = display.noPrint;}
Copy link to clipboard
Copied
When I said show, what I meant to say was visible but doesn't print.
Copy link to clipboard
Copied
One more update. I have buttons, not text fields. The correct question is:
If have Checkbox1, Text Field1, Button1, Button2, Button3 and Button4. I would like to noPrint and hide as follows:
CB1 not checked and TF1 contains no text = noPrint B1, hide B2, B3 and B4
CB1 not checked and TF1 contains text = noPrint B2, hide B1, B3 and B4
CB1 checked and TF1 contains text = noPrint B3, hide B1, B2 and B4
CB1 checked and TF1 contains no text = noPrint B4, hide B1, B2 and B3
Copy link to clipboard
Copied
Add an invisible text field and place this script as calculation script:
var CB1 = this.getField("Checkbox1");
var Tx1 = this.getField("TextField1");
var B1 = this.getField("Button1");
var B2 = this.getField("Button2");
var B3 = this.getField("Button3");
var B4 = this.getField("Button4");
B1.display = display.hidden;
B2.display = display.hidden;
B3.display = display.hidden;
B4.display = display.hidden;
if (B1.value === "Off" && Tx1.value === Tx1.defaultValue) {B1.display = display.noPrint;}
else if (B1.value === "Off" && Tx1.value != Tx1.defaultValue) {B2.display = display.noPrint;}
else if (B1.value != "Off" && Tx1.value != Tx1.defaultValue) { B3.display = display.noPrint;}
else if (B1.value != "Off" && Tx1.value === Tx1.defaultValue) {B4.display = display.noPrint;}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Entering text in Text Field1 makes Button3 visible, removing text makes Button4 visible. Checking Checkbox1 has no effect.
Copy link to clipboard
Copied
In the script provided by JR Boulay it's missing 'C' in each condition, it should look like this if(CB1.value
Copy link to clipboard
Copied
I used this now but nothing becomes visible:
var CB1 = this.getField("Checkbox1");
var Tx1 = this.getField("TextField1");
var B1 = this.getField("Button1");
var B2 = this.getField("Button2");
var B3 = this.getField("Button3");
var B4 = this.getField("Button4");
B1.display = display.hidden;
B2.display = display.hidden;
B3.display = display.hidden;
B4.display = display.hidden;
if (CB1.value === "Off" && Tx1.value === Tx1.defaultValue) {B1.display = display.noPrint;}
else if (CB1.value === "Off" && Tx1.value != Tx1.defaultValue) {B2.display = display.noPrint;}
else if (CB1.value != "Off" && Tx1.value != Tx1.defaultValue) { B3.display = display.noPrint;}
else if (CB1.value != "Off" && Tx1.value === Tx1.defaultValue) {B4.display = display.noPrint;}
Copy link to clipboard
Copied
Your field name is "Text Field1" not "TextField1".
Copy link to clipboard
Copied
In the script provided by JR Boulay it's missing 'C' in each condition
Oops!
It's always better with a test file.
Attached.
var CB1 = this.getField("Checkbox1");
var Tx1 = this.getField("Text Field1");
var B1 = this.getField("Button1");
var B2 = this.getField("Button2");
var B3 = this.getField("Button3");
var B4 = this.getField("Button4");
B1.display = display.hidden;
B2.display = display.hidden;
B3.display = display.hidden;
B4.display = display.hidden;
if (CB1.value === "Off" && Tx1.value === Tx1.defaultValue) {B1.display = display.noPrint;}
else if (CB1.value === "Off" && Tx1.value != Tx1.defaultValue) {B2.display = display.noPrint;}
else if (CB1.value != "Off" && Tx1.value != Tx1.defaultValue) { B3.display = display.noPrint;}
else if (CB1.value != "Off" && Tx1.value === Tx1.defaultValue) {B4.display = display.noPrint;}
Copy link to clipboard
Copied
That worked. Thank you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now