1 Reply Latest reply on Aug 13, 2012 11:15 AM by ESMITH.CU

    Script to save file name as text field AND timestamp


      Hello Adobe Wizards!


      I'm (BRAND) new to Javascript, and I've gleaned quite a bit from this forum.  However, I'm still in the dark about lots.


      Here's what I'm going for.  I have a "submit" button at the bottom of a form with looots of editable fields.  2 very important fields are "Name" and "SID"- for the name and ID number of the client.  I want the submit button to save the .pdf with the file name " 'Name', 'SID', TimeStamp"  where TimeStamp is a automated timestamp created at the time the form is submitted.


      It would also be helpful if I could have the "submit" button enter the same file name actually on the form, in a text field I have on the top of the first page.  I have started that script but can only figure out how to include the SID field (see below). I'm swimming in code that I don't understand!! Someone- throw me a life jacket!



      Here's my best crack at the script that includes the SID and TimeStamp in a text box at the top of my form.


      // get the current date object
       var oNow = new Date();
       // get the milliseconds from the Epoch date
       var fTime = oNow.getTime();
       // trim to seconds
      var fSeconds = fTime / 1000;
       // truncate to seconds
       var fTimeStamp = Math.floor(fSeconds)
         // set the SID field to a variable
       var fSID = this.getField('SID');
        // populate the 'TimeStamp' field's value
       this.getField('TimeStamp').value = fSID + fTimeStamp;


      Thank you all!