3 Replies Latest reply on Mar 13, 2015 8:38 AM by danielh72984686

    radio button

    danielh72984686

      How can turn On or Off a Radio Button based on a Text Box Score Number?

      I have tried using a javascript under the radio button dialog box. but I can not figure out how to turn the Radio Button On/Off.

      This is what I have so far.

       

      var Result = this.getField("Total AAS").value;

      if (Result > 7).

        • 1. Re: radio button
          danielh72984686 Level 1

          Sorry, I am adding to my post more detail info. Can someone please help me with this? I am trying to get the 2 checkboxes to read the value in the total score are a state Yes (Positive Results) or check No (Negative Results). I can not figure out where to put the javascript that reads the value of a text box "Total AAS" and use an if statement that would state witch checkbox "PosR" or "NegR" would be checked. Have attached the pdf file for your viewing.

          • 2. Re: radio button
            George_Johnson MVP & Adobe Community Professional

            If you tried to attach a PDF to an email, it will not show up in the forum posting. You can instead upload it somewhere (acrobat.com, dropbox, etc.) and post a link to it.

             

            The script doesn't belong attached to either of the checkboxes, but rather the "Total AAS" field. If the total field is calculated, how is it currently set up? What are the export values of the two check boxes? I'm assuming you want the check boxes to be read-only, correct?

            • 3. Re: radio button
              danielh72984686 Level 1

              Hello George,

              Thuis is what I have in the text box that adds the up the checkbox amount.

               

              var v1 = this.getField("1ADS").value;

              if (v1=="Not") event.value = 0;

              else if (v1=="Several") event.value = 1;

              else if (v1=="More") event.value = 2;

              else if (v1=="Nearly") event.value = 3;

              else event.value = 0;

               

              Then I have another text box at the bottom of the checkbox(s) fields "TotalADS"that just uses the calculation button to add up all the other textboxs.

               

              Then I had to write a script to tell if the results where above or below a certain number and check the correct box.

               

              var tscore = this.getField("TotalADS");

              if (tscore.value > 7){

              getField("PosResult").checkThisBox(0,true);

              }

              else {

              getField("PosResult").checkThisBox(0,false);

              }

              if (tscore.value < 8){

              getField("NegResult").checkThisBox(0,true);

              }

              else {

              getField("NegResult").checkThisBox(0,false);

              }

               

              This is working, but I have to locate the script in the last CheckBox in order for it to run correctly. It does not run if i put this script in the Total Results checkbox.

              If you have any suggestions, I would love to here them.

              Dan