Skip to main content
maneringa62988531
Participant
January 28, 2018
Answered

only one radio button required in group of multiple selections

  • January 28, 2018
  • 3 replies
  • 2067 views

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.

This topic has been closed for replies.
Correct answer try67

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.

3 replies

Known Participant
January 29, 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

try67
Community Expert
Community Expert
January 29, 2018

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

Legend
January 28, 2018

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

maneringa62988531
Participant
January 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?

Legend
January 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.

maneringa62988531
Participant
January 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).

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:

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.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 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.