Skip to main content
?Ydksod
Participant
March 29, 2021
Answered

Want conditional formatting that changes a field to "required" when box is checked

  • March 29, 2021
  • 1 reply
  • 530 views

I'm creating a PDF form that has a checkbox "Other" with two lines underneath. I want to require the fields be filled in, but only if they check "other." I need help!

 

Thanks in advance,

Linda

This topic has been closed for replies.
Correct answer Nesa Nurani

If you want to make fields required when checkbox is checked, you can use this code as Mouse UP event of checkbox:

this.getField("Field1").required = event.target.value != "Off" ? true : false;
this.getField("Field2").required = event.target.value != "Off" ? true : false;

 

Change field names to your field names.

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
March 29, 2021

If you want to make fields required when checkbox is checked, you can use this code as Mouse UP event of checkbox:

this.getField("Field1").required = event.target.value != "Off" ? true : false;
this.getField("Field2").required = event.target.value != "Off" ? true : false;

 

Change field names to your field names.

?Ydksod
?YdksodAuthor
Participant
March 29, 2021

Thank you, that worked beautifully. I feel pretty good being able to follow your code!