H
Help Me
I am using the following code to try to autofill a date time picker with the
current date. But it is giving me a null or is not an object error on the
line that says "if (xmlNode.getAttribute("xsi:nil")) " Can anyone see why?
function XDocument::OnLoad(eventObj)
{
if (!(XDocument.IsNew))
return;
if (XDocument.IsSigned)
return;
var now = new Date();
var xmlNode =
XDocument.DOM.documentElement.selectSingleNode("my:myFields/my
ateSubmitted");
if (xmlNode.getAttribute("xsi:nil"))
xmlNode.removeAttribute("xsi:nil");
xmlNode.text = getDateString(now);
}
function getDateString(oDate)
{
if (oDate == null)
oDate = new Date();
var m = oDate.getMonth() + 1;
var d = oDate.getDate();
if (m < 10)
m = "0" + m;
if (d < 10)
d = "0" + d;
return oDate.getFullYear() + "-" + m + "-" + d;
}
current date. But it is giving me a null or is not an object error on the
line that says "if (xmlNode.getAttribute("xsi:nil")) " Can anyone see why?
function XDocument::OnLoad(eventObj)
{
if (!(XDocument.IsNew))
return;
if (XDocument.IsSigned)
return;
var now = new Date();
var xmlNode =
XDocument.DOM.documentElement.selectSingleNode("my:myFields/my
if (xmlNode.getAttribute("xsi:nil"))
xmlNode.removeAttribute("xsi:nil");
xmlNode.text = getDateString(now);
}
function getDateString(oDate)
{
if (oDate == null)
oDate = new Date();
var m = oDate.getMonth() + 1;
var d = oDate.getDate();
if (m < 10)
m = "0" + m;
if (d < 10)
d = "0" + d;
return oDate.getFullYear() + "-" + m + "-" + d;
}