<?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: Afterchange code looping</title><link>https://www.infopathdev.com:443/forums/thread/22702.aspx</link><pubDate>Tue, 28 Aug 2007 17:02:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22702</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22702.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22702</wfw:commentRss><description>&lt;p&gt;You need to validate your code well here, becuase when you empty a field only &amp;quot;Delete&amp;quot; event gets fired. If you need to perform some operations even when the node becomes empty then you need to have another if condition for &amp;quot;Delete&amp;quot; operation.&lt;/p&gt;</description></item><item><title>Re: Afterchange code looping</title><link>https://www.infopathdev.com:443/forums/thread/22699.aspx</link><pubDate>Tue, 28 Aug 2007 16:23:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22699</guid><dc:creator>shaun.nieves</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22699.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22699</wfw:commentRss><description>&lt;p&gt;I don&amp;#39;t have a lot of experience with this but I think it&amp;#39;s because of the way the DOM works. For onAfter and before changes fire twice. One for insert and one for delete.&amp;nbsp;This is covered in Patrick Halsteads book so if you&amp;#39;re going to be doing a lot of custom work I highly recommend it. The jist of it is you have to filter out one of the events. For instance&lt;/p&gt;
&lt;p&gt;&amp;nbsp;If (e.Operation = &amp;quot;Insert&amp;quot;) Then&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do something&lt;/p&gt;
&lt;p&gt;End if&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Do something will fire only on the insert and not for delete. I hope that made sense. Good luck!&lt;/p&gt;</description></item><item><title>Afterchange code looping</title><link>https://www.infopathdev.com:443/forums/thread/22694.aspx</link><pubDate>Tue, 28 Aug 2007 13:27:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22694</guid><dc:creator>ninjaben</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22694.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22694</wfw:commentRss><description>&lt;font size="2"&gt;
&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;i am having problems with an afterchange event on a date field with a confirm dialogue, the code is as follows:&lt;/p&gt;
&lt;p&gt;function msoxd_my_Overall_Implementation_Date:nAfterChange(eventObj)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;if (eventObj.IsUndoRedo)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;var resp = XDocument.UI.Confirm(&amp;quot;Are you sure you want to commit to this date?&amp;quot;,4);&lt;/p&gt;
&lt;p&gt;var objDataElement = XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:field116&amp;quot;);&lt;/p&gt;
&lt;p&gt;objDataElement.text = resp;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;The problem we are encountering is that the code loops through twice, the first time it makes the field required, then the second it adds the date, is anyone aware of&amp;nbsp;a way to&amp;nbsp;fix&amp;nbsp;to this matter?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;p&gt;Ben&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>