3 Replies Latest reply on Nov 14, 2017 12:37 PM by SIPRNet11

    Cannot get a radio button to be selected when a text field (Dropdown menu) has specific text selected.

    SIPRNet11 Level 1

      I've been researching this for quite some time and it's getting frustrating that I can't figure it out myself!  I have a PDF form.  One field is a drop down menu.  And then I have a group of radio buttons and a group of checkboxes.  I have the group of radio buttons because only choice can be made ("Auth" or "Priv").  Group name is "14X: Type of Access".  I have the checkboxes set up ("15X: U" and "15X: C") because more than one box can be checked.  My code is allowing the checkbox to be selected but the radio button won't.  The drop down menu has several choices and depending on the choice selected, either one or both of the checkboxes can be selected along with only one of the radio buttons ("Auth" or "Priv").  Here's a short version of what I have so far but only the "15X: U" checkbox is being checked and unchecked when I deselect "NIPR":

       

      var X = this.getField("14X: Type of Access");
      var A = this.getField(X.name+"Auth");
      var P = this.getField(X.name+"Priv");
      //NIPR IS SELECTED
      if (event.value == "NIPR"){
       this.getField("15X: U").checkThisBox (0, true)
      }
      else
      {
       this.getField("15X: U").checkThisBox (0, false)
      }
      //TYPE OF ACCESS REQUIRED VALIDATION FOR "AUTHORIZED" BOX
      if (event.value == "NIPR"){
        A.checkThisBox (0, true)
      }
      else
      {
       A.checkThisBox (0, false)
      }
      //NIPR ADMINISTRATOR IS SELECTED
      if (event.value == "NIPR Administrator"){
       this.getField("15X: U").checkThisBox (0, true)
      }
      else
      {
       this.getField("15X: U").checkThisBox (0, false)
      }
      //TYPE OF ACCESS REQUIRED VALIDATION FOR "PRIVILEGED" BOX
      if (event.value == "NIPR Administrator"){
        P.checkThisBox (0, true)
      }
      else
      {
       P.checkThisBox (0, false)
      }
      
        • 1. Re: Cannot get a radio button to be selected when a text field (Dropdown menu) has specific text selected.
          SIPRNet11 Level 1

          Ok so I was able to get a portion of this code to work.  Depending on what text is selected, the Unclass and/or Class checkboxes are selected...here's that code:

           

          this.getField("15X: U").checkThisBox(0, (event.value=="NIPR" || event.value=="NIPR Portal Only" || event.value=="NIPR Administrator" || event.value=="NIPR and SIPR" || event.value=="NIPR Portal and SIPR"));

           

          this.getField("15X: C").checkThisBox(0, (event.value=="SIPR" || event.value=="NIPR and SIPR" || event.value=="SIPR Administrator" || event.value=="NIPR Portal and SIPR"));

           

          Now, I just need help with the other half please!  The radio buttons!

          • 2. Re: Cannot get a radio button to be selected when a text field (Dropdown menu) has specific text selected.
            SIPRNet11 Level 1

            Ok!  So I figured it out for the second part.  Here is my final code:

             

            this.getField("15X: U").checkThisBox(0, (event.value=="NIPR" || event.value=="NIPR Portal Only" || event.value=="NIPR Administrator" || event.value=="NIPR and SIPR" || event.value=="NIPR Portal and SIPR"));

             

            this.getField("15X: C").checkThisBox(0, (event.value=="SIPR" || event.value=="NIPR and SIPR" || event.value=="SIPR Administrator" || event.value=="NIPR Portal and SIPR"));

             

            this.getField("14X: Type of Access").checkThisBox(0, (event.value=="NIPR" || event.value=="NIPR Portal Only" || event.value=="NIPR and SIPR" || event.value=="NIPR Portal and SIPR"));

             

            this.getField("14X: Type of Access").checkThisBox(1, (event.value=="NIPR Administrator" || event.value=="SIPR Administrator"));

             

            The only problem I have now is in the drop down menu I have a choice labeled "Select from the Drop Down Menu".  when they select that, I'd like both radio buttons to reset unchecked.  Is that possible?  I have a reset form button but I'd rather when "Select from the Drop Down Menu" is selected they reset.

            • 3. Re: Cannot get a radio button to be selected when a text field (Dropdown menu) has specific text selected.
              SIPRNet11 Level 1

              HAHA!  Nevermind!  I got it all to work!

               

              this.getField("15X: U").checkThisBox(0, (event.value=="NIPR" || event.value=="NIPR Portal Only" || event.value=="NIPR Administrator" || event.value=="NIPR and SIPR" || event.value=="NIPR Portal and SIPR"));

               

              this.getField("15X: C").checkThisBox(0, (event.value=="SIPR" || event.value=="NIPR and SIPR" || event.value=="SIPR Administrator" || event.value=="NIPR Portal and SIPR"));

               

              this.getField("14X: Type of Access").value = "Off";

               

              this.getField("14X: Type of Access").checkThisBox(0, (event.value=="NIPR" || event.value=="NIPR Portal Only" || event.value=="NIPR and SIPR" || event.value=="NIPR Portal and SIPR"));

               

              this.getField("14X: Type of Access").checkThisBox(1, (event.value=="NIPR Administrator" || event.value=="SIPR Administrator"));