Skip to main content
?Ydksod
Participant
Mar 29, 2021 7:31 PM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
Mar 29, 2021 7:53 PM UTC

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.

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
Mar 29, 2021 7:53 PM UTC

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.

Translate
?Ydksod
?YdksodAuthor
Participant
Mar 29, 2021 10:00 PM UTC

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

Translate