• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Jul 17, 2017 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

TOPICS
PDF forms

Views

7.9K

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

Community Expert , Jul 17, 2017 Jul 17, 2017

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

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

Votes

Translate

Translate
Community Expert ,
Jul 17, 2017 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";

Votes

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 ,
Jul 18, 2017 Jul 18, 2017

Copy link to clipboard

Copied

Awesome! That worked perfectly! Thank you!

Votes

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 ,
Nov 05, 2021 Nov 05, 2021

Copy link to clipboard

Copied

Thank you! You are my savior!

Votes

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 25, 2022 Mar 25, 2022

Copy link to clipboard

Copied

Hi there, sorry to be ignorant but I am new to adobe sign. Where do I enter this text?

Votes

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 ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

You go to the check box while in Prepare Form - go to Actions tab - select Mouse Up - selection Action is Run a Java Script - click Add.  A box will come up for you to paste this text.  Be sure to change the generic "text" info to the name of the text box you'd like to make required.

Votes

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
Community Beginner ,
Oct 27, 2023 Oct 27, 2023

Copy link to clipboard

Copied

Would you you do this in AdobeSign?

Votes

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 ,
Jan 10, 2024 Jan 10, 2024

Copy link to clipboard

Copied

That worked perfectly!  Thank you!

Is there a way to clear the "Set required field" attributes (red square box) if the user entered text in the field?

Thanks

Votes

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 ,
Jan 10, 2024 Jan 10, 2024

Copy link to clipboard

Copied

I'm not sure I explained my question very well.

After I run your java script above and the user enters data into the field that is now required.  The red box is still around it, making the user think they did something wrong.  So, I would like when the user enters data then the red box is cleared on change/exit.  I hope that explains it better.  Thanks

Votes

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
Community Expert ,
Jan 10, 2024 Jan 10, 2024

Copy link to clipboard

Copied

As 'Validation' script or as 'On Blur' action of that field, use this:

if(event.value)
event.target.required = false;

Votes

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 ,
Jan 10, 2024 Jan 10, 2024

Copy link to clipboard

Copied

LATEST

Your script using the On Blur worked perfectly!  Thanks so much!  I appreciate your time.

Votes

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
Explorer ,
Nov 07, 2020 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?

Votes

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
Explorer ,
Jul 20, 2022 Jul 20, 2022

Copy link to clipboard

Copied

Can I also jump in on this thread with a question related to this?

 

How can we hide that required text field and make it visible when the check box is selected? Will the code provided work if we add another code after it?

Votes

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