Skip to main content
Participating Frequently
June 28, 2024
Resuelto

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

  • June 28, 2024
  • 1 respuesta
  • 556 visualizaciones

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);

 

Este tema ha sido cerrado para respuestas.
Mejor respuesta de 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 respuesta

PDF Automation Station
Community Expert
Community Expert
June 28, 2024

Where is your script located?

PDF Automation Station
Community Expert
Community Expert
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);

 

PDF Automation Station
Community Expert
Community Expert
June 28, 2024

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;}