<?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>Browser Forms</title><link>https://www.infopathdev.com:443/forums/40.aspx</link><description>For browser form specific questions</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Error Can't call XmlForm.Submit from SubmitEventHandler</title><link>https://www.infopathdev.com:443/forums/thread/49760.aspx</link><pubDate>Mon, 07 Dec 2009 15:59:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49760</guid><dc:creator>carlosq</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49760.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=49760</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;The code to reproduce the problem is quite simple:&lt;/p&gt;&lt;p&gt; 1) Create a InfoPath 2007 form with browser compatibility&lt;/p&gt;&lt;p&gt;2) Add a button &amp;quot;Button1&amp;quot; with custom code that executes this.Submit();&lt;/p&gt;&lt;p&gt;3) Configure the Form Submit Options to submit the form using custom code that does nothing:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Button1_Clicked(object sender, ClickedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Submit();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void FormEvents_Submit(object sender, SubmitEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.CancelableArgs.Cancel = false; // Success&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;4) Publish the form to a MOSS Form library (admin approval with the Central Administration)&amp;nbsp; &lt;/p&gt;&lt;p&gt;When you open the form on a browser and you click the button, you get an error like &amp;quot;Can&amp;#39;t call XmlForm.Submit from SubmitEventHandler&amp;quot; (or similar, I have translated it from Spanish to English).&lt;/p&gt;&lt;p&gt;I think that the problem happens because InfoPath or InfoPath Forms Services thinks that the Button1_Clicked method is a SubmitEventHandler, when it is not. The call to XmlForm.Submit it is not in a submit event handler, it is in a button click event handler, which is different. In my view this is a bug of the product.&lt;/p&gt;&lt;p&gt;Using the click event of the button to call the same code that is in the &amp;quot;Submit&amp;quot; event and remove the Submit event handler is not a solution for me since I want to:&lt;/p&gt;&lt;p&gt;a) When the button is clicked, perform some actions before submitting the form. I have actually several buttons (&amp;quot;Approve&amp;quot;, &amp;quot;Reject&amp;quot;, etc) so each button has its own code.&lt;/p&gt;&lt;p&gt;b) Submit the form if the actions are ok&lt;/p&gt;&lt;p&gt;c) Close the form. According to this, it must be done through the &amp;quot;Form Submit Options&amp;quot;, &amp;quot;Advanced&amp;quot;, &amp;quot;Close the form&amp;quot; option:&lt;/p&gt;&lt;p&gt;How to execute code and close an InfoPath web-based form&lt;br /&gt;&lt;a href="http://www.bizsupportonline.net/blog/2009/01/how-to-programmatically-run-code-close-infopath-web-form/"&gt;http://www.bizsupportonline.net/blog/2009/01/how-to-programmatically-run-code-close-infopath-web-form/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Error Can't call XmlForm.Submit from SubmitEventHandler</title><link>https://www.infopathdev.com:443/forums/thread/49731.aspx</link><pubDate>Fri, 04 Dec 2009 23:07:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49731</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49731.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=49731</wfw:commentRss><description>&lt;p&gt;Someone commenting on an InfoPath&amp;nbsp;Team Blog post had the same issue at one point. The blog post is &lt;a href="http://blogs.msdn.com/infopath/archive/2006/11/08/submitting-to-this-document-library.aspx"&gt;here&lt;/a&gt;, and the comment is about a third of the way down.&lt;/p&gt;
&lt;p&gt;The person who replied to the comment suggest:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;- Use the click event of the button to call the same code that is in the &amp;quot;Submit&amp;quot; event and remove the Submit event handler. &lt;/p&gt;
&lt;p&gt;NOTE:&amp;nbsp;... you will &amp;nbsp;need to remove the &amp;quot;e.CancelableArgs&amp;quot; lines.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You may also want to try posting your code here, in case someone can see what might be wrong. &lt;/p&gt;</description></item><item><title>Error Can't call XmlForm.Submit from SubmitEventHandler</title><link>https://www.infopathdev.com:443/forums/thread/49513.aspx</link><pubDate>Mon, 30 Nov 2009 12:41:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:49513</guid><dc:creator>carlosq</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/49513.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=40&amp;PostID=49513</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;I have a web-based form (InfoPath Forms Services) and InfoPath 2007. In my form:&lt;/p&gt;&lt;p&gt;&amp;nbsp;- I have a button with the action &amp;quot;Rules and custom code&amp;quot;, and in the custom code (click event handler) I perform some validations and I call this.Submit()&lt;/p&gt;&lt;p&gt;- The Form Submit Options are configured to use custom code (FormEvents_Submit event handler). The code calls the Execute method of a connection.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;When I try this approach in the preview, it works fine, but when the form is hosted in InfoPath Forms Services, I get this error:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;quot;Can&amp;#39;t call XmlForm.Submit from SubmitEventHandler&amp;quot; (or similar, it is a translation from Spanish)&lt;/p&gt;&lt;p&gt;I don&amp;#39;t understand why is this happening since the Click event handler of the button&amp;nbsp; (that calls XmlForm.Submit) is &lt;b&gt;not&lt;/b&gt; a SubmitEventHandler (the method FormEvents_Submit is) , it is the click event handler of a button.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Any ideas? Is it a bug?&lt;/p&gt;&lt;p&gt;I am using this approach because I have to use several buttons to submit the form with different meanings and validations, and I want the form closed after submit, something that seems to be possible only using&amp;nbsp; Form Submit Options with the advanced option of closing the form. &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>