4 Replies Latest reply on Jul 21, 2011 12:09 PM by try67

    Change the name of a field

    DeveloperM

      I am new to Adobe so I cobbled the following javascript together based on what I saw elsewhere in the forum, to be run as a batch process. I need to update approximatly 35 forms and the intent is to remove the "2" from the middle of 4 field names:

       

       

      /* ChangeName */

       

      // List of fields to change
      var aFields = ["AppA2RestYes", "AppA2RestNo", "AppB2RestYes", "AppB2RestNo"];

       

      // Loop through the fields and remove the "2" from the name:

      for (var i = 0; i < 4; i += 1) {
         var f = getField(aFields[i]);
         if (f) {
           f.value = f.valueAsString.replace("2", "");
           }

       

      }

       

       

      This is not working.  Can someone point out the error of my ways?

       

      Thanks!