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

Required Field becomes Not Required when Checkbox is Checked

New Here ,
May 17, 2017 May 17, 2017

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
1.3K
Translate
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;

Translate
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;

Translate
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

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?

Translate
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

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.

Translate
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

That worked! So awesome!

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

Translate
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
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.

Translate
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