<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Insert date into field</title><link>https://www.infopathdev.com:443/forums/thread/15128.aspx</link><pubDate>Wed, 21 Feb 2007 21:42:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15128</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15128.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=15128</wfw:commentRss><description>I think I may have figured it out using the bible according to Patrick. Here's my solution&lt;br /&gt;&lt;br /&gt;The following is in a OnBeforeChange event handler&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    Dim dToday As Date = DateTime.Today()&lt;br /&gt;            Dim vToday As Date = dToday.AddDays(-90).ToString&lt;br /&gt;&lt;br /&gt;            Dim idNumber As String = e.Site.text&lt;br /&gt;            If (idNumber &amp;gt; DateTime.Today) Then&lt;br /&gt;                e.ReturnMessage = "The incoming date can not be greater than today"&lt;br /&gt;                e.ReturnStatus = False&lt;br /&gt;            ElseIf (idNumber &amp;lt; vToday) Then&lt;br /&gt;                e.ReturnMessage = "The incoming date can not be less than 90 days ago"&lt;br /&gt;                e.ReturnStatus = False&lt;br /&gt;            End If&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I'd still like to know how to insert dates programattically though....</description></item><item><title>Re: Insert date into field</title><link>https://www.infopathdev.com:443/forums/thread/15127.aspx</link><pubDate>Wed, 21 Feb 2007 16:32:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15127</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15127.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=15127</wfw:commentRss><description>Thanks for the reply Shiva. I've converted to string and have even stripped that nil content error. Now the date field is populated however I'm getting an error that Only date allowed (example: 2001-03-14) and it's not firing the validation. If I reset the value of the text box the validation fires but not be default. Here is my code snippet&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; Dim dToday As Date = DateTime.Today()&lt;br /&gt;            Dim vToday As Date = dToday.AddDays(-90).ToString&lt;br /&gt;            thisXDocument.DOM.selectSingleNode("my:myFields/my:Misc/my:Date-90").attributes.removeNamedItem("xsi:nil")&lt;br /&gt;            thisXDocument.DOM.selectSingleNode("/my:myFields/my:Misc/my:Date-90").text = CDate(vToday)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks again for all your help!</description></item><item><title>Re: Insert date into field</title><link>https://www.infopathdev.com:443/forums/thread/15126.aspx</link><pubDate>Wed, 21 Feb 2007 06:47:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15126</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15126.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=15126</wfw:commentRss><description>Hi Shaun Nieves,&lt;br /&gt;&lt;br /&gt;Whenever we are trying set the one value to node it should be format of string only. Before you are setting the value, you have to convert it into string then try to set this value.</description></item><item><title>Insert date into field</title><link>https://www.infopathdev.com:443/forums/thread/13065.aspx</link><pubDate>Wed, 21 Feb 2007 00:40:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13065</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13065.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13065</wfw:commentRss><description>I'm using managed code to be used as a validator for a date field. I have a date picker and I want a validation error to fire if the date selected is less than 90 days from the current date. To accomplish this, I've used the onload event to calculate the date however I can an error when trying to push the date to my date field. Here is my code. Any help would be greatly appreciated.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Dim dToday As Date = DateTime.Today()&lt;br /&gt;            Dim vToday As Date = dToday.AddDays(-90)&lt;br /&gt;            thisXDocument.DOM.selectSingleNode("my:myFields/my:Misc/my:Date-90").text = CDate(vToday)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And here is the error&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;System.Runtime.InteropServices.COMException&lt;br /&gt;'#PCDATA' is in nil content: &amp;lt;&lt;a target="_blank" href=http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-12T22-07-01}Date-90&amp;gt;.&gt;http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-12T22-07-01}Date-90&amp;gt;.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;   at Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode.set_text(String value)&lt;br /&gt;   at Microsoft.Office.Interop.InfoPath.SemiTrust.DOMNodeWrapper.set_text(String value)&lt;br /&gt;   at KINS_Incoming.KINS_Incoming.OnLoad(DocReturnEvent e)&lt;br /&gt;   at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)&lt;br /&gt;&lt;/pre&gt;</description></item></channel></rss>