We have a contractor request form and I have collected their account expiration into a custom date field in L&G. I have tried to use the field within an avform.setValue statement and it will not set the date field on the form. However, it will set a text variable.
I am looking for ideas.
Any help is appreciated.
Here is what I am currently attempting,
Set Variable non-visual with the account expiration date:
Debug shows [startdate_text] = [2018-06-15 05:00:00.0]
then substring out the year, month, day
year is ok, but the day and month are really strange
avform.registerExprSub(null, "${avform.startdate_text}", function(value) { monthch = avform.startdate_text.substring(5,2); avform.setValue('month',monthch); }); |
Month comes out "018-"
avform.registerExprSub(null, "${avform.AccountExpireDay}", function(value) { daych = avform.AccountExpireDay.substring(8,2); avform.setValue('day',daych); }); |
Day comes out "18-06-"
Guess I will look for today function from text..but the substring sure is not acting the way I thought it should
Thanks
Changed my approach, I can now get the day month and year using this:
Startdate_text is the account expiration gathered from AD.
avform.registerExprSub(null, "${avform.startdate_text}", function(value) {
var d = new Date(avform.startdate_text);
var daych =d.getDate();;
var monthch =d.getMonth();;
var monthch = monthch + 1;
var yearch =d.getFullYear();;
avform.setValue('day',daych);
avform.setValue('month',monthch);
avform.setValue('year',yearch);
});
Now to figure out how to set the date field.