2 Replies Latest reply on Aug 14, 2017 4:52 AM by jacobe49150233

    Help with stopping my autodate fill script at certain dates.


      Hi everyone.

      Im very new to javascript but learning. Im making i time sheet for my employer and have a calender widget on the first day of the week so whoever needs to use it can click on that datefield and choose a date. I wrote a script (With some inspiration from around here) to fill out the rest of the dates of the week. So if someone chooses monday 08/14-2017, the rest of the dates gets filled out by the script.

      I was asked if i could make it stop autofilling if a certain date is hit (We need to make them start a new timesheet at 2 dates each months , even if its midweek.) and im not sure where to go from here.


      This is the script i put in the costum calculation scripts for the other days. So this code is for tuesday and for wednesday i just changed the d.setdate to +2 etc.


      Any help on getting it to stop if i get the 20. and 31. of the month?


      (function () {  
          // Get date from field  
          var v = getField("Dato").valueAsString;  
          // Convert string to date  
          var d = util.scand("dd/mm-yy", v);  
          // Add days  
          d.setDate(d.getDate() + 1);  
          // Populate this field with the result  
          if (v) {  
              event.value = util.printd("dd/mm-yy", d);  
          } else {  
              event.value = "";