9 Replies Latest reply on Jan 29, 2018 2:07 AM by try67

    only one radio button required in group of multiple selections

    maneringa62988531 Level 1

      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.