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

How to make one of two fields required while keeping the option to multi select?

New Here ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

I have a fillable PDF where I'm trying to make required fields if certain actions are made. I can make several fields required if a check box is checked, but I'm struggling to figure out how to make one of two (or more) boxes required, but not all. The user should be able to select more than one so I can't do a radio button. However, if they choose at least one, the remaining options should no longer be required. 

 

Example

[  ] Check this box if you are having a great day. (If this box is checked, the following two fields become required.)

      [  ]  Hoke Poke (If this box is checked, the following check box is no longer required)

      [  ]  Red Light Green Light (If this box is checked, the preceeding check box is no longer required)

 

I'm using this.getField("chk1").required = event.target.value!="Off"; to make fields required if a checkbox is clicked (if that helps).

 

I've scoured the web and these forums and maybe I'm not searching the right thing, but I can't find what I'm looking for, thus I seek the communities help in this venture.

TOPICS
How to , JavaScript , PDF forms

Views

661

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 ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

There is nothing in Acrobat that would give you this behavior with just a couple of mouse clicks. You need to implement this in JavaScript on your own. You very likely not use the required property, but keep track of what is required and what is not in the background, and then when the user tries to submit (or save) the form, you would display a warning or an error. 

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

Copy link to clipboard

Copied

LATEST

I figured this out!!!!!!!!!!!!!!!!!!!!!!!!

I'm not sure if Adobe recently changed things to allow this, but here's exactly how to do.

I'm working in the webform module.

You create a required radio button. Then, you add a condition to the fields you want to be required if a specific radio button is pressed to say if it's selected "X" then this field shows. 

Now, depending on which radio button is pressed, the field shows up and is required. It's so cool! Let me know if you get this!!!

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