Skip to main content
Participating Frequently
June 28, 2024
Answered

Dropdown to populate checkbox with either of two different values checking same box

  • June 28, 2024
  • 1 reply
  • 538 views

Thanks in advance for your help!

 

I have a dropdown with three options:

Yes.

No because A.

No because B.

 

Later in the form, I want either a "yes" checkbox automatically checked or the "no" checkbox.

I can get the "yes" to work fine, but can't get the script to use both "no" responses--it just takes one. I'm sure I'm missing something little, but don't know what. Any suggestions? Thanks!

 

this.getField("LEP Special Factor Response Confirm No").checkThisBox(0,event.value == "No. The child's home language is English." ? true : false);
this.getField("LEP Special Factor Response Confirm No").checkThisBox(0,event.value == "No. The child's home language is not English, but they demonstrates appropriate English proficiency." ? true : false);
this.getField("LEP Special Factor Response Confirm Yes").checkThisBox(0,event.value == "Yes. The child demonstrates limited English proficiency." ? true : false);

 

This topic has been closed for replies.
Correct answer PDF Automation Station

Thanks so much! I knew that was happening, but had no idea how to fix it. Appreciate the help!


Assuming your check boxes are mutually exclusive, an easier way to write this script is to name the two checkboxes identically, with one export value as "Yes" and the other as "No".  Then add Yes and No export values to the dropdown statements.  Add the following custom keystroke script to the dropdown (assuming checkbox name is "Checkbox 1"):

 

if(!event.willCommit)

{this.getField("Checkbox 1").value=event.changeEx;}

1 reply

PDF Automation Station
Braniac
June 28, 2024

Where is your script located?

PDF Automation Station
Braniac
June 28, 2024

The second statement for the "No" checkbox is cancelling out the first.  Change your script to 

 

 

this.getField("LEP Special Factor Response Confirm No").checkThisBox(0,(event.value == "No. The child's home language is English." || event.value=="No. The child's home language is not English, but they demonstrates appropriate English proficiency.")? true: false);
this.getField("LEP Special Factor Response Confirm Yes").checkThisBox(0,event.value == "Yes. The child demonstrates limited English proficiency." ? true: false);

 

Participating Frequently
June 28, 2024

Assuming your check boxes are mutually exclusive, an easier way to write this script is to name the two checkboxes identically, with one export value as "Yes" and the other as "No".  Then add Yes and No export values to the dropdown statements.  Add the following custom keystroke script to the dropdown (assuming checkbox name is "Checkbox 1"):

 

if(!event.willCommit)

{this.getField("Checkbox 1").value=event.changeEx;}


Great! I'll try this, too. Googling for answers sometimes finds more complicated solutions than necessary! I appreciate the help.