5 Replies Latest reply on Sep 1, 2016 1:46 PM by codyc27327802

    Populate expiry date field when digitally signed.


      I am trying to get a text field to automatically populate when the form is digitally signed. The text field is an expiry date which needs to show the date 10 years less one day from time of signing. For example, if the form was signed today the Expiry Date text field should show August 31, 2026. I have been using the following JavaScript code in the Actions properties of the signature box:


      // JavaScript code to add the date at signing time

          var currentTime = new Date()

          var month = currentTime.getMonth() + 1

          var day = currentTime.getDate()- 1

          var year = currentTime.getFullYear() + 10

          var signingTime = month +"/"+day+"/"+year


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


          f.value = signingTime;


      This code had been working just fine, but obviously if the Date is the first of the month it will return a value of 0 for the day variable. I'm wondering if there is any way I can modify the script to prevent this error?