3 Replies Latest reply on Jul 19, 2013 9:50 AM by Diego243

    Radio buttons that pass a value to a textfield

    Diego243

      Hi everybody;

      I’m trying to create a “Rating Matrix” for the evaluation of new raw material. On this form I create a group of radio buttons (i.e. Radio1 to Radio5).

      Each radio represents a rating value “Poor=1, Fair=3, Average=5, Good=7, Excellent=9” and I would like to capture this rating (1 or 3 or 5, etc) into a Texfield.

      I work in solving this issue without success, if any of you have any example that I could look at it, I will really appreciate.

      Thanks in advance.

        • 1. Re: Radio buttons that pass a value to a textfield
          gkaiseril MVP & Adobe Community Professional

          Do you want to count the occurrence of each value and report that in a given text field?

           

          Do you understand that when no radio button or check box when not selected has a value of the string "Off".

           

          Assuming that the value for various radio buttons in a group is the value you want to test

           

          // custom calculation script;

          // count occurrences of "9" values

          var nTest = 9; // value to test for;

          var nCount = 0; // count of occurrences;

          // loop through the fields;

          for(i = 1; i < 6; i++) {

          var nValue = this.getField("Radio" + i).value;

          // test if field value equals test value;

          if(nTest == nValue) {

          nCount++; // values equal so increment count;

          } // end test of field value

          } // end field name loop;

          event.value = nCount; // set field value;

          // end custom calculation script;

          • 2. Re: Radio buttons that pass a value to a textfield
            Diego243 Level 1

            Thanks for your fast response! WowWhat I'm trying to do, is being able to pass a value to a TextField depending on the ratio button selected.If I choose one of the ratio buttons of the group "Opacity" (Opacity1, Opacity2, Opacity3, Opacity4 or Opacity5), I like the TextField "Rank" to show the value.If Opacity1 selected, Rank field value = 1.If Opacity2 selected, Rank field value = 3.If Opacity3 selected, Rank field value = 5.If Opacity4 selected, Rank field value = 7.If Opacity5 selected, Rank field value = 9.

            You think this can work?

            if(Opacity1.value == "On") {Rank.value==1; // value is added to the texfield;}

            if(Opacity2.value == "On") {Rank.value==3; // value is added to the texfield;} Else if(Opacity3.value == "On") {Rank.value==5; // value is added to the texfield;}

            Sorry not a programmer.I understand the loop, but is not very clear where I need to add this script, on the radio or in the textfield?Thanks.

            Date: Thu, 18 Jul 2013 11:48:28 -0700

            From: forums_noreply@adobe.com

            To: etchechury@hotmail.com

            Subject: Radio buttons that pass a value to a textfield

             

             

             

             

             

             

                  

                       

                       

                       

                Re: Radio buttons that pass a value to a textfield

             

             

                created by GKaiseril in JavaScript - View the full discussion

             

             

             

            Do you want to count the occurrence of each value and report that in a given text field?

            Do you understand that when no radio button or check box when not selected has a value of the string "Off".

            Assuming that the value for various radio buttons in a group is the value you want to test

            // custom calculation script;

            // count occurrences of "9" values

            var nTest = 9; // value to test for;

            var nCount = 0; // count of occurrences;

            // loop through the fields;

            for(i = 1; i < 6; i++) {

            var nValue = this.getField("Radio" + i).value;

            // test if field value equals test value;

            if(nTest == nValue) {

            nCount++; // values equal so increment count;

            } // end test of field value

            } // end field name loop;

            event.value = nCount; // set field value;

            // end custom calculation script;

             

             

             

                 Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5518047#5518047

                 Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5518047#5518047

                 To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5518047#5518047. In the Actions box on the right, click the Stop Email Notifications link.

                  

                 Start a new discussion in JavaScript by email or at Adobe Community

              For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

            • 3. Re: Radio buttons that pass a value to a textfield
              Diego243 Level 1

              Thanks for your fast response!I solve the issue adding this code in each radio button:this.getField("OpacityTotal").value = 1;

              I really appreciate your help.Regards.Diego

               

              Date: Thu, 18 Jul 2013 11:48:28 -0700

              From: forums_noreply@adobe.com

              To: etchechury@hotmail.com

              Subject: Radio buttons that pass a value to a textfield

               

               

               

               

               

               

                    

                         

                         

                         

                  Re: Radio buttons that pass a value to a textfield

               

               

                  created by GKaiseril in JavaScript - View the full discussion

               

               

               

              Do you want to count the occurrence of each value and report that in a given text field?

              Do you understand that when no radio button or check box when not selected has a value of the string "Off".

              Assuming that the value for various radio buttons in a group is the value you want to test

              // custom calculation script;

              // count occurrences of "9" values

              var nTest = 9; // value to test for;

              var nCount = 0; // count of occurrences;

              // loop through the fields;

              for(i = 1; i < 6; i++) {

              var nValue = this.getField("Radio" + i).value;

              // test if field value equals test value;

              if(nTest == nValue) {

              nCount++; // values equal so increment count;

              } // end test of field value

              } // end field name loop;

              event.value = nCount; // set field value;

              // end custom calculation script;

               

               

               

                   Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5518047#5518047

                   Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5518047#5518047

                   To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5518047#5518047. In the Actions box on the right, click the Stop Email Notifications link.

                    

                   Start a new discussion in JavaScript by email or at Adobe Community

                For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.