Skip to main content
Participant
June 20, 2023
Question

Radio Button, Check Boxes Conditional for Required Text Field

  • June 20, 2023
  • 1 reply
  • 1717 views

I desperately need help. I am a complete novice with scripts, but I've seen these formulas (below) in several threads and they seem to have worked for others.  I want to have a text field required if a radio button (in one instance) or a checkbox (in another instance) is selected. Another post indicated that it doesn't work with "Bulk Send". I'm not using that feature. I am selecting "Fill & Sign" from the side-panel menu and sending the form to one email address. I've also tried it by selecting "Request E-signatures" from the side panel. Neither one works. When said radio button or checkbox is selected the fields do not become "required". Even if I email the form with the trigger radio button or checkbox already selected... it will not become "required". It is showing as "required" if I select the button/checkbox in Preview mode and then switch to edit (Prepare form).  So the scripts are "working"... I think. Something is getting lost though when the form is emailed via Fill & Sign.

 

For the RADIO BUTTON, I have placed a Custom Calculation Script in the Text field. When I send the form for signatures, the desired text field does not become "required" when selected. (I've also tried placing a mouse-up action-JavaScript on the radio button.)

 

This is the information and the subsequent script for the required text field triggered by the RADIO BUTTON:

Radio Button Group: PracExOption

Radio Button Name: PracExYESspecial

Practice Example FORM FIELD PROPERTIES:

  • Field Name: PracEx
  • General Tab: "Required" is unchecked (tried checked also)
  • Calculate Tab: Custom calculation script is selected
  • SCRIPT:

event.target.required = (this.getField("PracExOption").valueAsString=="PracExYESspecial");

 

For the CHECKBOXES, the script that I used was applied to the checkbox action (MouseUp-- run a JavaScript). When the form was sent for signatures, checking the box did not make the targeted field become "required". (I also tried placing a custom calculation script in the required text field.)

CHECKBOX PROPERTIES:

General Tab:

  • Checkbox Name: OtherProd
  • Corresponding Form Field Name: OtherProdReq
  • “Required” is unchecked (tried checked also)

Actions Tab:

  • TRIGGER: Mouse Up:
  • ACTION: Run a Java Script
  • JAVA SCRIPT: this.getField("OtherProdReq").required = event.target.value!="Off";

 

Any guidance and insight would be much appreciated.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 20, 2023

The required property is only enforced when the form is submitted. Not when you send it out for signing.

**OnTop**Author
Participant
June 20, 2023

Yes, I'm aware, but thank you for clarifying that piece. When the form is filled out by the recipient, the conditional fields do not become "required". Note, there are other required fields that are not conditionally linked to a button or checkbox that ARE working as they should. 

try67
Community Expert
Community Expert
June 20, 2023

The code seems fine. Can you share the file?