Copy link to clipboard
Copied
Hello,
I came across another issue....
I have 3 checkboxes (CB1, CB2 and CB3)
I like CB4 to be checked when only CB3 is checked.
If any of the other combinations are checked (when cb1 and cb3 are checked or cb2 and cb3) cb4 needs to be unchecked.
i try using other scrips i found but i cant find the right solution.
For all of you masters here, it would be a piece of cake i guess 😉
Copy link to clipboard
Copied
Write out a table showing the state of the check boxes (forced checked, forced unchecked, and user controled) depending on what is checked. Cover all combinations.
Use this to write scripts for the MouseUp event on each checkbox.
Copy link to clipboard
Copied
I dont know what you mean. im just learning....
the thing is, i only try to use scrips when there is no other way so its hard to put time in it to learn properly.
A start would be helpful 😉
Copy link to clipboard
Copied
As the custom calculation script of a (hidden) text field enter the following code:
var CB1 = this.getField("CB1").valueAsString!="Off";
var CB2 = this.getField("CB2").valueAsString!="Off";
var CB3 = this.getField("CB3").valueAsString!="Off";
this.getField("CB4").checkThisBox(0, !CB1 && !CB2 && CB3);
Copy link to clipboard
Copied
It worked perfectly thnx.....
but i made one misstake.....
CB4 isnt a checkbox but a radiobutton called Group4 and its the 3rd choice.
What wil be different?
Copy link to clipboard
Copied
Yes, that will be different. What's the export value for the 3rd Choice?
You can read about how radiobuttons and checkboxes work in Acrobat here:
https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm
Copy link to clipboard
Copied
the export value is Choice3
Copy link to clipboard
Copied
Then this is how the code changes
var CB1 = this.getField("CB1").valueAsString!="Off";
var CB2 = this.getField("CB2").valueAsString!="Off";
var CB3 = this.getField("CB3").valueAsString!="Off";
if(!CB1 && !CB2 && CB3)
this.getField("CB4").value = "Choice3";
Copy link to clipboard
Copied
Do you want the user to be able to tick the other fields in the group, though? If so, that would require a different kind of script