Copy link to clipboard
Copied
I've had this answered in the past for a similar query. I tried to use a previous script from a different form but i can't seem to make the adjustments for a new, different form.
It's a simple form for dates. I have 14 fields (Date1-Date14). I want to enter the beginning date in Date1 and the rest of the dates auto populate for two weeks. The script I have seems to duplicate Date1 into Date2 then Date3 is fine. (Enter Date1 as 7/16. Date2=7/16, Date3=7/18). What am I missing so Date2 shows as 7/17?
Here's the script I'm using in "run Custom Validation Script" in Date1:
var date = util.scand("m/d/yy", event.value);
for( var i=2; i<=14; i++){
if(event.value == ""){
this.getField("Date2").value = "";
this.getField("Date"+i).value = "";}
else {
date.setDate(date.getDate() +1);
this.getField("Date2").value = event.value;
this.getField("Date"+i).value = util.printd("m/d/yy", date);}}
I've made several changes but it either duplicates Date1 into Date2 or doesn't complate any of them at all. I've tried searching the forum but nothing seems to pop up.
Thanks!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Remove following line:
this.getField("Date2").value = event.value;
Copy link to clipboard
Copied
Thanks! That works!