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

New Here ,
Mar 29, 2021 Mar 29, 2021

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

39

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Mar 29, 2021 Mar 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.

Likes

Translate

Translate
Adobe Community Professional ,
Mar 29, 2021 Mar 29, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 29, 2021 Mar 29, 2021

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines