<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Updating an element right before submitting</title><link>https://www.infopathdev.com:443/forums/thread/37037.aspx</link><pubDate>Tue, 13 Jan 2009 19:56:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37037</guid><dc:creator>admot</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37037.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37037</wfw:commentRss><description>&lt;p&gt;I believe I found a way. Just use try/catch.&amp;nbsp;I also had to turn off the default message via Submitting Forms\Submit Options. Strange that it shows an error if the person cancels but so be it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;try&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;XDocument.DataAdapters[&amp;quot;SubmitviaEmail&amp;quot;].Submit();&lt;br /&gt;&amp;nbsp;&amp;nbsp;XDocument.UI.Alert(&amp;quot;The form was submitted successfully.&amp;quot;);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;// Setting ActiveWindow.Close to true will close InfoPath immediately. Setting to false prompts to save the form.&lt;br /&gt;&amp;nbsp;&amp;nbsp;Application.ActiveWindow.Close(true);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;catch(e)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;XDocument.UI.Alert(&amp;quot;The request has been cancelled.&amp;quot;);&lt;br /&gt;&amp;nbsp;}&lt;/p&gt;</description></item><item><title>Re: Updating an element right before submitting</title><link>https://www.infopathdev.com:443/forums/thread/37035.aspx</link><pubDate>Tue, 13 Jan 2009 18:31:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37035</guid><dc:creator>admot</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37035.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37035</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/infopathdev/images/icon-quote.gif"&gt; &lt;strong&gt;warrtalon:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;Do you need to use code for this?&amp;nbsp; It&amp;#39;s a built-in feature with a checkbox on the Browser tab of the Form Options menu.&amp;nbsp; If your form is not browser-enabled, I would think you could add a Refresh rule to your Submit &amp;quot;button&amp;quot; that refreshes any or all data&amp;nbsp;connections&amp;nbsp;before the submit action itself.&lt;/p&gt;
&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using IP 2003 and I didn&amp;#39;t see that option available. There will already be a submit button at the top of the form where it submits via email data connection.&amp;nbsp;Since it was a requirement to use the Data Connection, having two submit buttons would confuse the user.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think I figured it out but there&amp;#39;s still a problem:&lt;/p&gt;
&lt;p&gt;1) Instead of submitting to email, submit via code.&lt;/p&gt;
&lt;p&gt;2)&amp;nbsp; Use the following code:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;XDocument.DOM.selectSingleNode(&amp;quot;my:....&amp;quot;).text = XDocument.Errors.Count;&lt;br /&gt;&amp;nbsp;XDocument.DataAdapters[&amp;quot;ExtranetSubmit&amp;quot;].Submit();&lt;/p&gt;
&lt;p&gt;This seems to work fine. But if I cancel the submit, I get an error back stating it was cancelled. Is there an error handle I can place in where if they cancel, it will just accept the cancel?&lt;/p&gt;</description></item><item><title>Re: Updating an element right before submitting</title><link>https://www.infopathdev.com:443/forums/thread/36812.aspx</link><pubDate>Thu, 08 Jan 2009 22:58:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36812</guid><dc:creator>warrtalon</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36812.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=36812</wfw:commentRss><description>&lt;p&gt;Do you need to use code for this?&amp;nbsp; It&amp;#39;s a built-in feature with a checkbox on the Browser tab of the Form Options menu.&amp;nbsp; If your form is not browser-enabled, I would think you could add a Refresh rule to your Submit &amp;quot;button&amp;quot; that refreshes any or all data&amp;nbsp;connections&amp;nbsp;before the submit action itself.&lt;/p&gt;</description></item><item><title>Updating an element right before submitting</title><link>https://www.infopathdev.com:443/forums/thread/36776.aspx</link><pubDate>Thu, 08 Jan 2009 17:12:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36776</guid><dc:creator>admot</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36776.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=36776</wfw:commentRss><description>&lt;p&gt;I would like to update an element right before the person uses the Submit button used in Tools\Submitting forms. I figured I&amp;#39;d use OnSubmitRequest.&lt;/p&gt;&lt;code&gt;
&lt;p&gt;function XDocument::OnSubmitRequest(eventObj) &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;&amp;nbsp;XDocument.DOM.selectSingleNode(&amp;quot;my:...&amp;quot;).text = XDocument.Errors.Count; &lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But for some reason, it doesn&amp;#39;t update it on a submit. Is my code too simplistic? I did a search in the forums but didn&amp;#39;t find anything. I&amp;#39;m updating an element to count # of errors, because the form can be submitted also via email attachment and I have a webservice checking for IPFormError.&lt;/p&gt;
&lt;p&gt;Any help is appreciated. Thanks,&lt;/code&gt;&lt;/p&gt;</description></item></channel></rss>