5 Replies Latest reply on Mar 25, 2017 8:52 AM by mexicomike

    Unique ID using two characters from a form field plus date and time


      I am completely new to Javascript, so please bear with me!

      I have an acrobat form. I would like to use Javascript to take the last two characters contained in one field on the form and join them to the current date and time, putting the result in a second field. For example: ABCD, becomes CD-24-Jan-2017-20:39


      Something like this but it doesn't work, as the "WeighOrderNum" field remains blank with no ID!


      var n = this.getField("RegNum").valueAsString.substr(-2);

      var d = new Date(); //current date and time

      var df = util.printd("-dd-mmm-yyyy-HH:MM", d)

      var f = this.getField("WeighOrderNum");

      f.value = n + df;


      Any help is much appreciated.