edit:
I think I may have found the solution to this problem from:
http://blog.vishalon.net/index.php/infopath-a-proper-way-to-blank-out-whole-number-date-using-jscript
Thank you all!!!
-------------------
Hello Everyone,
Im hoping someone could help me out here. I'm using the code found here: http://www.infopathdev.com/blogs/matt/archive/2005/11/29/Repeat-Table-Headers-Across-Multiple-Printed-Pages.aspx.
I'm attempting to make the code work on my form where there is no secondary source data. Here are my changes:
I replaced the following lines of codes:
// Set up access to secondary data source.
var domVehicles = XDocument.GetDOM("Vehicles");
// Source nodes.
var oVehicles = domVehicles.selectNodes("/Vehicles/Vehicle");
With the following codes:
// Set up access to secondary data source.
//var domTable = XDocument.GetDOM("/my:myFields");
// Source nodes
var oVehicles = XDocument.DOM.selectNodes("/my:myFields/my:TableData/my:RowData");
I replaced these lines:
oNewRow.selectSingleNode("my:Year").text = oSrc.selectSingleNode("@year").nodeValue;
oNewRow.selectSingleNode("my:Make").text = oSrc.selectSingleNode("@make").nodeValue;
oNewRow.selectSingleNode("my:Model").text = oSrc.selectSingleNode("@model").nodeValue;
oNewRow.selectSingleNode("my:Description").text = oSrc.selectSingleNode("@description").nodeValue;
With these:
oNewRow.selectSingleNode("my:IssueDT").text = oSrc.selectSingleNode("my:deIssueDT").text;
oNewRow.selectSingleNode("my:BgnDT").text = oSrc.selectSingleNode("my:deBgnDT").text;
oNewRow.selectSingleNode("my:EndDT").text = oSrc.selectSingleNode("my:deEndDT").text;
oNewRow.selectSingleNode("my:ChkNum").text = oSrc.selectSingleNode("my:deChkNum").text;
The code works if I set my fields to string. However I need to change some of the fields to 'date' and 'whole number" fields. But after I changed from string fields, I get the "#PCData is in Nil content" error message. I'm using Infopath 2003 sp1.
I tried removing the xsi:nil attributes using this:
if (oNewRow.getAttribute("xsi:nil"))
oNewRow.removeAttribute("xsi:nil");
I tried it in many places changing the oNewRow...but I keep getting the error message. Can someone please point out the proper location/syntax to fix the #PCData error message?!? Any help is greatly appreciated.
Thank you.