1 Reply Latest reply on Jun 20, 2011 7:17 PM by George_Johnson

    Creating a Script for check boxes


      I have a simple question, but I am new to scripting.  I have a form with 5 checkboxes.  Depending upon which check box the user selects, I need to populate a value in a text field.  Each check box should populate a different value for the same text field.  I also need to restrict the users to only select one check box.  Any suggestions?

        • 1. Re: Creating a Script for check boxes
          George_Johnson MVP & Adobe Community Professional

          Give each check box the same name but different export value. Set the export value of each check box to the string that you want to display in the text field when it's selected. If you don't want the text field to be editable by the user, you can use the following as the text field's custom Calculate script:


          // Custom Calculate script for text field
          (function () {
              // Get the value of the check box
              var v = getField("check1").value;
              // Set this field's value
              if (v !== "Off) {
                  event.value = v;
              } else {
                  event.value = "";


          When no check boxes are selected, the text field will be blank. When one is selected, the text field will get set to the export value of the check box that is selected.


          Replace "check1" in the code above with the name that you are using for the group of check boxes.