5 Replies Latest reply on Feb 27, 2013 10:57 AM by George_Johnson

    Acrobat X Javascript error ( TypeError: f is null )

    slehgrlabel

      Hello

       

      I am trying to create a PDF Form file with an auto advancing sequential number upon opening.

       

      I have the fields all created, etc. all is good there. I found an old post on the forum regarding this from 2010.

      There was a script available that was posted, and by all accounts appears to work for those involved with the old post.

       

      I have created a field labeled "jobCount" as suggested, I have placed the script in the Actions tab of the field menu. I also created an Action for the script to see if that did the trick. The purpose is to have the sequential number advance as in a purchase Order Form.

       

      When I try it out however i get an error of TypeError: f is null and nothing happens. I know very little about scripting at this point and I am trying to get this to work.

       

      Below is the script I have placed within the document:

       

      if (global.count == null) //checks to see if count exists

      {

      global.count = 95000 //sets initial count, you can change to suite your needs

      global.setPersistent("count",true) //makes the counter a global object so it is persistent data

      }

      else

      global.count++ //increments the the counter by one when the document is opened

      var f = this.getField("jobCount") //creates a variable for the form field where the counter will be displayed

      f.value = global.count //sets the form field to equal the counter

       

      Here are some screen shots of my set up.

       

      1.png2.png3.png