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

only one radio button required in group of multiple selections

New Here ,
Jan 27, 2018 Jan 27, 2018

Currently creating an application form where there are required "Yes" or "No" answers (using radio buttons).

1.  I'd like to have the form require either Yes or No to be selected but not both.  I've used the required selection under Properties>General. However, it is still requiring both to be checked even though they are in the same group.

I've read several js scripts but they don't seem to fit these needs as it seems to be too simple.

2.  Also, on another part of the form, if the applicant marks "Yes" I'd like a text box then be required (to explain why). So, first require a "Yes" or "No" if "Yes" then require "Textbox1"

3. If at all possible, if the applicant hasn't selected an option in the required radio button group, have the group display a message "Select at least one option"

The closest I could find to #2 is, I believe:

if (event.target.value == "Three") {

    this.getField("Text Field 1").required = false;

}

For #3 I believe it is similar to:

<script>
function validateForm() {
  var x = document.forms["myForm"]["radioGroupName"].value;
  if (x == "") {
  document.getElementById("message").innerHTML = "Select atleast one option";
  }

</script>

Any assistance would be greatly appreciated.  Thank you.

TOPICS
Acrobat SDK and JavaScript , Windows
1.9K
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 , Jan 28, 2018 Jan 28, 2018

The red border only means the field is set as required. It doesn't change when you fill it in (or not).

The validation of the required fields only occurs when you actually submit the file.

If you want the red border to appear/disappear based on whether or not the field has a value you would need to use a custom script to do it.

Translate
LEGEND ,
Jan 28, 2018 Jan 28, 2018

For question 1, I don’t understand what you mean by “requiring Both” since the essence of a radio button group is that you can only have one selected. If you can select more than one of them the name must be different so they aren’t a group.

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 ,
Jan 28, 2018 Jan 28, 2018

Hello Test Screen Name, thank you for your reply.

I just did a quick check to see if there weren't in the same group and I do have them in the same group.  So, I don't think that is it.  I've attached the editor view photo for you to see what I am trying to express (albeit somewhat poorly, lol).

Editor Mode.jpg

So, as you can see, they are in the same group and I have them all as required fields.  So when I go to try and fill out the application form it results in the following:

Use Test.jpg

For some reason it is still showing that the other radio buttons are required.

I hope this clears up what I was trying to say.  Thank you again 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
Community Expert ,
Jan 28, 2018 Jan 28, 2018

The red border only means the field is set as required. It doesn't change when you fill it in (or not).

The validation of the required fields only occurs when you actually submit the file.

If you want the red border to appear/disappear based on whether or not the field has a value you would need to use a custom script to do it.

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 ,
Jan 28, 2018 Jan 28, 2018

I see, thank you.

I have been trying to write a script to do something to that effect.  Can you help with the writing of the script?  I'm not sure as to where to start and I have been going through the forums to figure out how to do so.

btw, are you the same try67 that has the website? Custom-made Adobe Scripts

I've gone through it and read a few of your answers online, they've been really helpful in the past. Thank you!

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 ,
Jan 28, 2018 Jan 28, 2018

I am!

Glad to hear you found my website useful. If you wish me to develop this script for you feel free to contact me privately.

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
LEGEND ,
Jan 28, 2018 Jan 28, 2018

Have you defined them as required? That isn't necessary for radio buttons.

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 ,
Jan 28, 2018 Jan 28, 2018

Yes, I have them as required so that the applicants won't skip past them (unfortunately, it happens).

Do you know of another way to make it so that the person can't skip past them or gets a notification that they need to fill in that area?

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 ,
Jan 28, 2018 Jan 28, 2018

   Hello.Did you find the answer for the No1 question?Because i have the same problem.If yes please sent me the answer.Thanks

e-mail klothos2@gmail.com

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 ,
Jan 29, 2018 Jan 29, 2018
LATEST

Read the full thread, please. I answered this question above.

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