4 Replies Latest reply on Jan 30, 2017 9:45 AM by delmacewen

    Check boxes and Auto populating text boxes


      I have  a form in  Adobe acrobat where i have multiple checkboxes.  Is there a way that if multiple check boxes are checked, the first check shows up on the first text box, and the second check box shows up in the second text box and so on, but; if the first check box is blank, and the second one is checked, could the second check box populate to the first text box instead of the second text box and so on down the line of all checkboxes required to auto populate text?


      // array of field names to use

      var aFieldNames = new Array("cb1", "cb2", "cb3", "cb4", "cb5", "cb6", "cb7", "cb8", "cb9", "cb10", "cb11", "cb12", "cb13", "cb14", "cb15", "cb16", "cb17", "cb18", "cb19", "cb20", "cb21", "cb22", "cb23", "cb24", "cb25", "cb26", "cb27", "cb28", "cb29", "cb30", "cb31", "cb32", "cb33", "cb34", "cb35", "cb36");

      // clear the result field

      event.value = "";

      // variable for testing the value of a single field

      var cItem = "";

      // array of values not equal to "Off"

      var aValues = new Array();

      // process each field name

      for (i = 0; i < aFieldNames.length; i ++) {

      // get i name's field value as a string

      cItem = this.getField(aFieldNames[i]).valueAsString;

      // see if value not equal to "Off"

      if(cItem != "Off") {

      // add to array of non "Off" values

      aValues[aValues.length] = cItem;

      } // end not "Off" value

      } // end loop names

      // set field value

      event.value = aValues.join(" - \n\n");


      this is my coding right now, i can't figure out how to stop the array when a box is checked, then populate into the first open text box, and then start again after the checked check box.