13 Replies Latest reply on Oct 29, 2015 4:15 AM by omanbux

    one javascript is working but other not

    omanbux Level 1

      Hi, bellow my first javascript i working but second one not working. can u pls help me to fix it. thanks in advance..

       

      working script.

       

      if (app.viewerVersion < 10) {

          app.addMenuItem({ cName: "RemoveToolTips", cUser: "Remove Tool Tips", cParent: "Tools",

          cExec: "RemoveToolTips()", cEnable: "event.rc = (event.target != null);"});

      } else {

          app.addToolButton({ cName: "RemoveToolTips", cLabel: "Remove Tool Tips", cTooltext: "Remove Tool Tips",

           cExec: "RemoveToolTips()", cEnable: "event.rc = (event.target != null);"});

      }

       

      function RemoveToolTips() {

            // get the number of fields in this PDF

      var nNumFields = this.numFields;

      // a variable for the field name being processed

      var cFieldName;

      // loop through all of the fields in the PDF

      for(i = 0; i < nNumFields; i++) {

      // get the field name for the ith field

      cFieldName = this.getNthFieldName(i);

      // set the userName to a null string

      this.getField(cFieldName).userName = "";

      } // end for loop

      }

       

       

      not working script.


      if (app.viewerVersion < 10) {

          app.addMenuItem({ cName: "CheckboxStyleCheck", cUser: "Checkbox Style Check", cParent: "Tools",

          cExec: "CheckboxStyleCheck()", cEnable: "event.rc = (event.target != null);"});

      } else {

          app.addToolButton({ cName: "CheckboxStyleCheck", cLabel: "Checkbox Style Check", cTooltext: "Checkbox Style Check",

           cExec: "CheckboxStyleCheck()", cEnable: "event.rc = (event.target != null);"});

      }

       

      function CheckboxStyleCheck() {

      / Loop throught the fields in the document 

          for (var i = 0; i < numFields; i++) { 

           

              // Get a reference to the current field 

              var f = getField(getNthFieldName(i)); 

            

              switch(f.type) { 

              case "checkbox": 

                  f.style = style.ch;    

                  f.textSize = 0;    

                  break; 

             

              } 

             } 

      }