Copy link to clipboard
Copied
Im fairly new to this and need assistance. I have a set of checkbox that need to meet certain conditions. Here are the conditions. I have two columns of checkboxes. Column one has checkbox 1, 2 and 3 and column two has 4, 5, and 6. If checkbox 1 is checked then checkbox 3 is checked automatically. If checkbox 2 is checked then checkbox 3 is checked automatically. If checkbox 4 is checked then checkbox 6 is checked automatically and if checkbox 5 is checked then checkbox 6 is automatically checked. Here is the other part that i need assistance with. If checkbox 1 is checked then checkbox 4 is disabled and checkbox 3 is checked automatically. If checkbox 2 is also checked then checkbox 5 is disabled and checkbox 3 is still checked, but if checkbox 5 is checked then checkbox 2 is disabled and checkbox 4 is unchecked.
Copy link to clipboard
Copied
See if this works for you, use it in a text field as custom calculation script:
var c1 = this.getField("checkbox 1");
var c2 = this.getField("checkbox 2");
var c3 = this.getField("checkbox 3");
var c4 = this.getField("checkbox 4");
var c5 = this.getField("checkbox 5");
var c6 = this.getField("checkbox 6");
if(c1.isBoxChecked(0,true)){
c3.checkThisBox(0,true);
c4.readonly = true;}
else
c4.readonly = false;
if(c2.isBoxChecked(0,true)){
c3.checkThisBox(0,true);
c5.readonly = true;}
else
c5.readonly = false;
if(c4.isBoxChecked(0,true))c6.checkThisBox(0,true);
if(c5.isBoxChecked(0,true)){
c6.checkThisBox(0,true);
c2.readonly = true;
c4.checkThisBox(0,false);}
else
c2.readonly = false;
Copy link to clipboard
Copied
Thank you for your response. what you provided did work but not the way I need it to work. When c1 is checked, c3 is checked which is good. but when i uncheck c1, c3 is still checked. i need it to uncheck automatically. Here is what would like for this to work.
Yes Column
If c1 is checked then c3 is checked automatically and c4 is disabled
If c2 is checked then c3 is checked automatically and c5 is disabled
c3 should not be a checkable, possibly be a readonly box that is checked on when c1 or c2 is checked
same thing should happen for No column
Here is the twist. If c4 is checked and of course c6 is checked. if c2 is checked then c6 needs to be unchecked automatically. and of course since c2 is checked c3 will be checked automatically. Basically if there are any check marks in the Yes column then the No column c6 is automatically unchecked. i hope this makes sense.
Copy link to clipboard
Copied
Try this:
var c1 = this.getField("checkbox 1");
var c2 = this.getField("checkbox 2");
var c3 = this.getField("checkbox 3");
var c4 = this.getField("checkbox 4");
var c5 = this.getField("checkbox 5");
var c6 = this.getField("checkbox 6");
c3.checkThisBox(0,(c1.valueAsString != "Off" || c2.valueAsString != "Off"));
if(c1.valueAsString != "Off"){
c4.value = "Off";
c4.readonly = true;}
else
c4.readonly = false;
if(c2.valueAsString != "Off"){
c5.value = "Off";
c5.readonly = true;}
else
c5.readonly = false;
c6.checkThisBox(0,c3.valueAsString == "Off" && (c4.valueAsString != "Off" || c5.valueAsString != "Off"));
Copy link to clipboard
Copied
What you provided worked. But I need one thing to troubleshoot. As stated before on the Yes column when c1 is checked c5 is automatically checked. On the No column when c6 is checked then c10 is automatically checked also. Here is how it is setup now. If question 1 answer is yes (c1) then c6 is automatically checked. If question 2 answer is no (c7) then c10 is automatically checked. Now there c5 and c10 both have check marks. If question 3 answers is yes (c3) then c10 is automatically unchecked. But if the final question 4 the answer is no (c8) then c10 is checked. so now i have both c5 and c10 with checkmarks. I need to figure out a way that if any questions are answered yes, that the final (c5) is alway the only box that is checked. You can still have an answer in the No column but c5 should always override any checkbox. If there are any questions answered in the yes column, then c10 should not have a check mark. Only time c10 should be checked is if all answers are NO. i hope you can see the pdf i uploaded. How about a script that says c10 is checked only when all c6, c7, c8 and c9 are marked. I hope this makes sense.
Copy link to clipboard
Copied
box1
if(this.getField("Box1").valueAsString!="On"){this.getField("Box2").value="Off";}
box2
if(this.getField("Box2").valueAsString!="On"){this.getField("Box1").value="Off";}
Copy link to clipboard
Copied
The state of the checkbox when checked is not 'On' unless you set its export value to be 'On'.
Are you are trying to create mutually exclusive checkboxes? There is an easier solution to do so:
Give both checkboxes same name but different export value.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Are those mutually exclusive checkboxes or single?
Is 'YES' export value of those checkboxes?
Can you share the file?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
So Check Box5 is a "NO" which should be checked if any of the checkboxes are checked except for scenario of C1-3 are "YES"?
You should have make checkboxes mutually exclusive, so only one can be checked from YES/NO. For example change Check Box6 name to Check Box1, Check Box7 to Check Box2, Check Box8 to Check Box3, and Check Box5 to Check Box4, now only one at a time can be checked, and it will simplify script also.
Copy link to clipboard
Copied
Nesa, I don't have any experience doing this type of work. Can you help me with that?
Copy link to clipboard
Copied
Aloha from Hawaii. I'm learning about acrobat and have several applications for which acrobat is perfect for. I have a somewhat similar question. However, my requirement is that once All checkboxes are checked a final checkbox automatically becomes checked indicating the completion of the assigned task. Is this something that can be done in Javascript? If so, I really don't know javascript how would this be executed? The current project I'm working on has seven (7) training requirements and when each is completed they check a box. As a show of completion there is a "Completed" checkbox which I would like to automatically be select once All other requirements are met.
Copy link to clipboard
Copied
Can you share the file or tell us the name of the checkboxes?