Hi,
My requirement is i have a startdate using datepicker and the end date should be qutomatically filled as {Startdate+3}. I'm not using infopath 2007, so i cannot use addDays function. I'm writing a code like
This code gets the default date as today and sets the value to current date+3. But i want (startdatevalue+3)
// Get today's date
var three_days_from_now = new Date();
// add three days
three_days_from_now.setDate(three_days_from_now.getDate() + 3);
// Select the node where the value will be stored
var targetNode = XDocument.DOM.selectSingleNode("/my:myFields/my:threeDaysFromNow");
// If the node has a nil attribute it needs to be removed
var nilAttribute = targetNode.getAttributeNode("xsi:nil");
if(nilAttribute != null)
{
targetNode.removeAttributeNode(nilAttribute);
}
// Store the date in XML format YYYY-MM-DD, adding zeros where necessary
targetNode.text = three_days_from_now.getFullYear() + '-' +
zeroPad(three_days_from_now.getMonth() + 1, 2) + '-' + zeroPad(three_days_from_now.getDate(), 2);
Please suggest.
Thanks,
Monisha