1 Reply Latest reply on Sep 16, 2010 5:17 PM by George_Johnson

    What custom javascript action of a radio button will assign a value to a text box?

    justin34346565

      Does anyone know the javascript to make a radio button, when clicked, assign a value, other than its own value,  to a text box or other field?

        • 1. Re: What custom javascript action of a radio button will assign a value to a text box?
          George_Johnson MVP & Adobe Community Professional

          There are two general approaches. One is to use code in the MouseUp event of the radio buttons to assign a value to a field. The simplest would be:

           

          getField("text1").value = (event.target.value !== "Off") ? "Hello" : "";

           

          The other is to set up the text field as a calculated field, and do something like the following in the field's Calculate event:

           

          event.value = (getField("radio1).value !== "Off") ? "Hello" : "";

           

           

          The last script does not attempt to see which radio button was selected due to your "other than its own value" stipulation, but you should get the idea.