6 Replies Latest reply on Oct 9, 2015 2:54 AM by Alex Doubts

    How to set focus to a form field on opening a PDF?

    Alex Doubts Level 1

      How to set focus to a form field on opening a PDF?

       

      I am doing the below code to set focus and all other required under Document Level Javascripts as a new function SAVE(). With the below code if setFocus is not there I am able to save the pdf without any save dialog prompt if no changes are made. Else the save alert box comes even without changing data in the PDF.

       

      function SAVE()

      {

           getField("txtCurrentdate").setFocus();

           getField("txtCurrentdate").value = util.printd("dd-mmm-yyyy", new Date()).toUpperCase();

          if (getField("Date").value == "") {

              getField("Date").value = util.printd("dd-mmm-yyyy", new Date()).toUpperCase();

          }

       

          this.getField("txtCurrentdate").fillColor = ["RGB", 0.8, 0.8, 0.8];

          this.getField("txtFormReference").fillColor = ["RGB", 0.8, 0.8, 0.8];

          this.getField("txtAmountInWords").fillColor = ["RGB", 0.8, 0.8, 0.8];

          this.dirty = false;

      }

      SAVE();