8 Replies Latest reply on May 31, 2016 2:20 PM by buddycafe

    Field to display today's date (mm/dd/yyyy) +15 days.

    buddycafe Level 1

      Good morning,

      I thought i nailed this one but it's doing something strange. My script is wrong but i'm learning as I go...

       

      I added a script that auto-populates today's date and adds + 15 days to the date. When I Preview the field, it works find. However when I tab over to another field and add a value (doesn't matter what the other fields are), the initial date field keeps adding more days. Example, if the next two fields were simple check boxes (not tied to the date field in any way) and I were to check the boxes back and forth, the date field keeps jumping to a higher date.

       

      var myDate = util.scand("mm/dd/yyyy", this.getField("GLOBAL__POSTING_DATE_15").valueAsString) ;

      myDate.setDate(myDate.getDate() + 15);

      event.value = util.printd("mm/dd/yyyy", myDate)

       

      Is there a way to keep the date displayed and not get updated unless the user manually changes the date and only then does it add 15 days to that new date?

       

      Thanks,

      Edgar Arreguin