Highlighted

Is there a way to make a text field required if a check box is clicked?

New Here ,
Jul 17, 2017

Copy link to clipboard

Copied

I have a form I am trying to adjust. I want to make add a text field and make it required only if a check box above is checked. If the box is not checked no data is necessary in the field. Would someone tell me how to make this work? I'm a bit of a novice at coding but I have a resource who could likely help if we're pointed toward the process to make it work. Thanks!

-Nathanael

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

As the Mouse Up event of the check-box enter this code:

this.getField("Text1").required = event.target.value!="Off";

TOPICS
PDF forms, Windows

Views

1.1K

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

Is there a way to make a text field required if a check box is clicked?

New Here ,
Jul 17, 2017

Copy link to clipboard

Copied

I have a form I am trying to adjust. I want to make add a text field and make it required only if a check box above is checked. If the box is not checked no data is necessary in the field. Would someone tell me how to make this work? I'm a bit of a novice at coding but I have a resource who could likely help if we're pointed toward the process to make it work. Thanks!

-Nathanael

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

As the Mouse Up event of the check-box enter this code:

this.getField("Text1").required = event.target.value!="Off";

TOPICS
PDF forms, Windows

Views

1.1K

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
Jul 17, 2017 0
Most Valuable Participant ,
Jul 17, 2017

Copy link to clipboard

Copied

As the Mouse Up event of the check-box enter this code:

this.getField("Text1").required = event.target.value!="Off";

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
Reply
Loading...
Jul 17, 2017 0
New Here ,
Jul 18, 2017

Copy link to clipboard

Copied

Awesome! That worked perfectly! Thank you!

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
Reply
Loading...
Jul 18, 2017 0
Explorer ,
Nov 07, 2020

Copy link to clipboard

Copied

I'm glad I found this post after searching for a couple of days, and have the following question:

If I have two text fields that I want to make a required entry, after a box is checked, do I just repeat the code with the new field name?

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
Reply
Loading...
Nov 07, 2020 0