I am trying to take the "Date Completed" field and add the value from $da2 to give me a due date "Due" field. I have tried so many different attempts that my mind is scrambled.. Any suggestions would be greatly appreciated. I have been all over the web and every example falls short. Here is my code.
//start of code
var $cycle = Runner.getControl (pageid, 'Maint Cycle in Days');
var d4 = Runner.getControl (pageid, 'Due');
var d5 = Runner.getControl(pageid,'Date Completed');
var d8 = Runner.getControl(pageid, 'Maint Cycle in Days');
var $da2;
function func() {
if ($cycle.getValue()=="1 Day"){ ($da2=1);
}
if ($cycle.getValue()=="3 Day"){ ($da2=3);
}
if ($cycle.getValue()=="15 Day"){ ($da2=15);
}
if ($cycle.getValue()=="30 Day"){ ($da2=30);
}
if ($cycle.getValue()=="60 Day"){ ($da2=60);
}
if ($cycle.getValue()=="90 Day"){ ($da2=90);
}
if ($cycle.getValue()=="120 Day"){ ($da2=120);
}
if ($cycle.getValue()=="180 Day"){ ($da2=180);
}
if ($cycle.getValue()=="365 Day"){ ($da2=365);
}
{
// set date
var userSelectedDate = new Date(Runner.getControl(pageid,'Date Completed'));
var mycustomdate = new Date();
mycustomdate.setDate(userSelectedDate.getDate() +$da2);
d4.setValue(mycustomdate);
}
};
d5.on('change', func);
d8.on('change', func);
Thanks in advance