<?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: Handling OnSubmitRequest() failure message</title><link>https://www.infopathdev.com:443/forums/thread/13841.aspx</link><pubDate>Thu, 25 May 2006 06:18:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13841</guid><dc:creator>DavidCrabbe</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13841.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13841</wfw:commentRss><description>Hi Deb,&lt;br /&gt;&lt;br /&gt;I wrote some custom validation for my form in addition to the standard validation offered by the Data Validation options on each control.  &lt;br /&gt;&lt;br /&gt;The following code is contained within a button control's OnClick method:&lt;br /&gt;&lt;br /&gt;// Submit the form. &lt;br /&gt;try &lt;br /&gt;{ &lt;br /&gt;  // ...validate the form according to any custom criteria &lt;br /&gt;  if( true == ValidateForm() ) &lt;br /&gt;  { &lt;br /&gt;    // Attempt to submit the form... &lt;br /&gt;    thisXDocument.Submit(); &lt;br /&gt;&lt;br /&gt;    // Provide feedback that the form has been submitted successfully... &lt;br /&gt;    MessageBox.Show( "Form submitted successfully.", "Form Submission" ); &lt;br /&gt;    &lt;br /&gt;    try &lt;br /&gt;    { &lt;br /&gt;      // ...and close the InfoPath application &lt;br /&gt;      thisApplication.ActiveWindow.Activate(); &lt;br /&gt;      thisApplication.ActiveWindow.Close( true ); &lt;br /&gt;    } &lt;br /&gt;    catch &lt;br /&gt;    { &lt;br /&gt;      // ...problem with closing the application &lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;There is also a means by which you can check programatically for the standard errors on the form (mandatory fields etc.), I think its an Error property on the document or something however I can't recall exactly, sorry.&lt;br /&gt;&lt;br /&gt;David.</description></item><item><title>Re: Handling OnSubmitRequest() failure message</title><link>https://www.infopathdev.com:443/forums/thread/13840.aspx</link><pubDate>Mon, 24 Apr 2006 14:43:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13840</guid><dc:creator>CycleFitness</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13840.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13840</wfw:commentRss><description>David:&lt;br /&gt;&lt;br /&gt;Would you be willing to share your code with me?  I need to:&lt;br /&gt;&lt;br /&gt;1)  On clicking the Submit button, through code, check to confirm all required fields have been entered and if not, display a message box, then leave the user in the form.  If they have, the form is then submitted (Sharepoint list) and InfoPath is closed.  I have the close code as Application.ActiveWindow.Close(true);&lt;br /&gt;&lt;br /&gt;THanks!</description></item><item><title>Re: Handling OnSubmitRequest() failure message</title><link>https://www.infopathdev.com:443/forums/thread/13839.aspx</link><pubDate>Wed, 26 Oct 2005 01:49:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13839</guid><dc:creator>franck</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13839.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13839</wfw:commentRss><description>You are welcome.&lt;br /&gt;&lt;br /&gt;Franck</description></item><item><title>Re: Handling OnSubmitRequest() failure message</title><link>https://www.infopathdev.com:443/forums/thread/13838.aspx</link><pubDate>Wed, 26 Oct 2005 01:07:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13838</guid><dc:creator>DavidCrabbe</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13838.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13838</wfw:commentRss><description>D'oh!  &lt;br /&gt;&lt;br /&gt;Thanks, Franck. I had a nagging doubt the answer was obvious. :)</description></item><item><title>Re: Handling OnSubmitRequest() failure message</title><link>https://www.infopathdev.com:443/forums/thread/13837.aspx</link><pubDate>Wed, 26 Oct 2005 00:48:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13837</guid><dc:creator>franck</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13837.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13837</wfw:commentRss><description>Hi David,&lt;br /&gt;&lt;br /&gt;Tools / Submitting Forms&lt;br /&gt;Click on Submit Options... &lt;br /&gt;Uncheck "Show message indicating success or failure"&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;&lt;br /&gt;Franck Dauché</description></item><item><title>Handling OnSubmitRequest() failure message</title><link>https://www.infopathdev.com:443/forums/thread/12636.aspx</link><pubDate>Tue, 25 Oct 2005 08:47:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12636</guid><dc:creator>DavidCrabbe</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12636.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12636</wfw:commentRss><description>I've written an OnSubmitRequest() function to check if data for all the required fields has been supplied.  Within the function I've called MessageBox to display an error if the validation fails.&lt;br /&gt;&lt;br /&gt;However I still receive the standard message: "InfoPath cannot submit the form.  The onSubmitRequest event handler returned a value indicating that the submit failed."&lt;br /&gt;&lt;br /&gt;Is there any way in which I can prevent this message from being displayed?&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;David.</description></item></channel></rss>