2 Replies Latest reply on Dec 16, 2010 5:13 AM by mlaruec

    Simple JS for One Check Box Initiating Another

    mlaruec

      Just getting into JS and need assistance with creating an action that when the user selects a specific radio button (say out of the possibility of three), the JS places a check in it and another radio button that's also on the form.

        • 1. Re: Simple JS for One Check Box Initiating Another
          George_Johnson MVP & Adobe Community Professional

          Check box or radio button? In any case, try the following in the checkbox/radio button's Mouse Up event:

           

           

          // Mouse Up script for checkbox/radio button

           

          // Get a reference to the other field

          var f = getField("other_radio");

           

          // Set the other field based on this value

          f.value = (event.target.value == "my_export_value") ? "other_export_value" : "Off";

           

           

          Replace "my_export_value" with the export/button value of the checkbox/radio button to which this script is attached. Replace "other_export_value" with the export/button value of the other checkbox/radio button that you want to control. Replace "other_radio" with the name field you want to control.

           

          This code assumes you want to deselect the other checkbox/radio button if the current field is not selected. If you don't want to do this, you can just do:

           

          // Get a reference to the other field

          var f = getField("other_radio");

           

          // Select the other field if this field is selected

          if (event.target.value == "my_export_value") {

              f.value = "other_export_value";

          }

          • 2. Re: Simple JS for One Check Box Initiating Another
            mlaruec Level 1

            George,

             

            Thank you so much for your time and energy concerning this inquiry. I'll be trying it out later today.

             

            Michael