2 Replies Latest reply: Jul 26, 2012 3:30 PM by Neil-Kentucky RSS

    Autofill Today's date as "d day of mmmm, yyyy"

    Neil-Kentucky Community Member

      I have a purchase contract I need to have auto-fill in the date. 

       

      The line reads, "Made this ____ Day of ______, _______.

      Filled-out it would read, ""Made this __3__Day of July__, 2012.

       

      I currently have my form fill in other date fields formatted as mm/dd/yyyy using this script and wondered if someone might know how to modify the script to change the format?

       

       

      function DateToday() {
      this.getField("DateToday").value = util.printd("mm/dd/yyyy", new Date())
      
      return true;
      } // end of DateToday() function
      
      
        • 1. Re: Autofill Today's date as "d day of mmmm, yyyy"
          MarkWalsh Community Member

          Are they separate fields, or a single field?

           

          Try this in the Calculation script for the field if you are using a single field (Otherwise, separate each value and use that for each individual field):

           

          var d = new Date()

          event.value = "Made this " + util.printd("d", d) + " Day of " + util.printd("mmmm", d) + ", "  + util.printd("yyyy", d) + "."

          Edit: If you need to use a separate function so the value doesn't change, you can alter your function

           

          function DateToday() {
          this.getField("DateToday").value = "Made this " + util.printd("d", d) + " Day of " + util.printd("mmmm", d) + ", "  + util.printd("yyyy", d) + "."
          return true;
          } // end of DateToday() function

          • 2. Re: Autofill Today's date as "d day of mmmm, yyyy"
            Neil-Kentucky Community Member

            The date field I use throughout the form is one field.  The field I'm trying to create i'd LIKE to be it's own field, but only one for the day, month, year combined.

             

            The first code you provided worked perfectly.  wow!  Thank you!