<?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: Date and Time Onload</title><link>https://www.infopathdev.com:443/forums/thread/49718.aspx</link><pubDate>Fri, 04 Dec 2009 14:43:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49718</guid><dc:creator>WonderLaura</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49718.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=49718</wfw:commentRss><description>&lt;p&gt;Custom code is really not necessary for this functionality.&amp;nbsp; On the Date/Time field, if you&amp;#39;ld like the date to NOT change the next time the form is opened, there&amp;#39;s a simple checkbox.&lt;/p&gt;
&lt;p&gt;On the properties for the field, UNcheck &amp;quot;Update this value when the result of the formula is recalculated&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Laura Rogers&lt;br /&gt;&lt;a href="http://sharepoint911.com/blogs/laura"&gt;http://sharepoint911.com/blogs/laura&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Date and Time Onload</title><link>https://www.infopathdev.com:443/forums/thread/49641.aspx</link><pubDate>Wed, 02 Dec 2009 16:56:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49641</guid><dc:creator>Gannje</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49641.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=49641</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Patrick and Jimmy, you guys are awesome... The form is working just the way I need it. Thanks to both of you.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Date and Time Onload</title><link>https://www.infopathdev.com:443/forums/thread/49638.aspx</link><pubDate>Wed, 02 Dec 2009 16:29:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49638</guid><dc:creator>Gannje</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49638.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=49638</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;That&amp;#39;s exactly what it is... But I&amp;#39;m very new to IP, I didn&amp;#39;t know about the substring() functions. Let me look into that, thanks. I might have to ask for some direction with this, but I&amp;#39;ll take a stab at it first.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Date and Time Onload</title><link>https://www.infopathdev.com:443/forums/thread/49636.aspx</link><pubDate>Wed, 02 Dec 2009 16:13:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49636</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49636.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=49636</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Isn&amp;#39;t that just the datetime with the hyphens and colons removed, and the T replaced with a hyphen?&lt;/p&gt;&lt;p&gt;&amp;nbsp;You should be able to construct this with XPath&amp;#39;s substring() functions.&amp;nbsp; No code needed. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Date and Time Onload</title><link>https://www.infopathdev.com:443/forums/thread/49635.aspx</link><pubDate>Wed, 02 Dec 2009 16:11:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49635</guid><dc:creator>Gannje</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49635.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=49635</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thank you. That worked great for the Date. Is there a way to do that with code? My other field is a number built from the current date and time to create the following format... 20091202-110931. Unfortunately there is no function or stock format for this in IP, that I have found. But I need it to do the same thing as the Date field, create a new number only if there is nothing in that field already. Thanks again.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Date and Time Onload</title><link>https://www.infopathdev.com:443/forums/thread/49601.aspx</link><pubDate>Wed, 02 Dec 2009 02:57:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49601</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49601.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=49601</wfw:commentRss><description>&lt;p&gt;Remove the calculations from the default value and create an Open Rule with a condition that checks to see if the field is blank or not and if so sets the value based on the function/calculation.&lt;/p&gt;</description></item><item><title>Date and Time Onload</title><link>https://www.infopathdev.com:443/forums/thread/49581.aspx</link><pubDate>Tue, 01 Dec 2009 17:48:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49581</guid><dc:creator>Gannje</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49581.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=49581</wfw:commentRss><description>&lt;p&gt;I have a form that has to auto fill fields, Date and RFQ ( which is a number&amp;nbsp;built from&amp;nbsp;the current date and time ). On the creation of a new form, these both work perfectly. My problem is after a form has been filled and saved to Share Point, when it is re-opened, the feilds are updated to the current date and time again, which I do not want. I have written a couple of Javascript&amp;nbsp;IF statements that check to see if the fields are empty before filling with the current D&amp;amp;T, and the code works perfectly when placed in an OnClick event. But when I move the code to the OnLoad event, the fields are updated whether it&amp;#39;s a new form or one that already contains data. I think the form is running the script before the fields can be updated with the data. Is there a way to use a Javascript delay with the Infopath OnLoad function, or is there something else I could be doing? Any help would be very appreciated. Below is my code for the Date field (the other is too long to post, and if I can get this one to work, they should both work anyway).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;function XDocument::OnLoad(eventObj)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;// Write your code here&lt;br /&gt;if (XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:header/my:Date&amp;quot;).text != &amp;quot; &amp;quot;)&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp; var ldate = new Date();&lt;br /&gt;&amp;nbsp;&amp;nbsp; XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:header/my:Date&amp;quot;).text = ldate.toLocaleDateString();&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks Again,&lt;/p&gt;</description></item></channel></rss>