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

Required Field becomes Not Required when Checkbox is Checked

New Here ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

I have a form that needs several required fields. However, when a certain checkbox is checked,

some of the fields are no longer necessary and need to become "not required" anymore.

Is there a way to do this? I'm not sure if it's even possible. If it is, it may require a java script.

I'm currently using Adobe Acrobat 8 Professional version 8.0.0 on Mac OS 10.5.8

I also have access to Adobe LiveCycle Designer ES4 on Windows 7

TOPICS
Acrobat SDK and JavaScript

Views

917

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

Yes. It's possible. You don't have any field name details though so I can't give you specific code but you just need to set the field required property to true or false. You code might look something like this.

this.getField("foo").required = false;

Votes

Translate

Translate
Community Expert ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

Yes. It's possible. You don't have any field name details though so I can't give you specific code but you just need to set the field required property to true or false. You code might look something like this.

this.getField("foo").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 ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

Thank you! Good to know it's possible.

The checkbox field name is "no previous employer" and one of the fields it needs to make not required is named "previous employer"

Can you tell me where I need to input the code to set the field required property?

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

Copy link to clipboard

Copied

Generally, if you want to change something in a field other than the one you're on after the user commits the value, you'd put it in the OnBlur script.

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

Copy link to clipboard

Copied

That worked! So awesome!

Can't thank you enough! You've been a big help.

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 06, 2020 Nov 06, 2020

Copy link to clipboard

Copied

LATEST

I have a similar question, but I'm not using a Mac.

Needing to have a second field as a required entry after checkbox checked.  I can get this to work for the first field but not the scond one.  I need the second field, "Date Entered" to also be a required entry.  Below is the script for the first field:

var v = this.getField("Name of Facility");

var f= event.target;

if (f.value !="Off") {

v.required = true;

} else {

v.required = false;

}

 

Thanks in advance for your help.

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