<?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: One button to Print and Submit Form</title><link>https://www.infopathdev.com:443/forums/thread/27972.aspx</link><pubDate>Tue, 15 Apr 2008 23:02:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27972</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27972.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27972</wfw:commentRss><description>&lt;p&gt;You&amp;#39;ve got the right idea, but you must do your own verification. This is typically done using a try/catch block.&lt;/p&gt;
&lt;p&gt;Please look up these methods in the documentation/help so that you can understand their requirements. For example, in order to use XDocument.Submit(), you must NOT disable submit in the toolbars. Here&amp;#39;s a quote from the help files:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Using the &lt;b class="bterm"&gt;Submit&lt;/b&gt; method is similar to, but not exactly like, using the submit operation from the InfoPath user interface. Calling the &lt;b class="bterm"&gt;Submit&lt;/b&gt; method simply performs the submit operation, but the submit operation must first be enabled for a form in design mode.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;&amp;nbsp;&amp;nbsp;You can write a custom submit operation using the &lt;b class="bterm"&gt;OnSubmitRequest&lt;/b&gt; event, and then you can programmatically call the event using the &lt;b class="bterm"&gt;Submit&lt;/b&gt; method.&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>One button to Print and Submit Form</title><link>https://www.infopathdev.com:443/forums/thread/27929.aspx</link><pubDate>Mon, 14 Apr 2008 18:26:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27929</guid><dc:creator>mcampbell</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27929.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=27929</wfw:commentRss><description>&lt;pre class="WNPost" style="WORD-WRAP:break-word;"&gt;I want to create a &amp;quot;Submit&amp;quot; button that print the form and submits the data to a database at the same time but only if certain conditions are true.  I have created a button in the form with an &amp;quot;OnClick(Eventobj) using the code XDocument.PrintOut(); and XDocument.Submit(); but this method does not verify to the user that the data submitted to the databased succeeded or failed like the &amp;quot;Submit&amp;quot; button does on the toolbar.  I have intentionally disabled the submit and print funtions from the Toolbar to control them printing/submitting the form based on conditions.&amp;nbsp;&lt;/pre&gt;&lt;pre class="WNPost" style="WORD-WRAP:break-word;"&gt;If I create a &amp;quot;Submit&amp;quot; button and then click &amp;quot;Custom Submit using form code&amp;quot; 
then click &amp;quot;Edit Form Code&amp;quot;, it shows:

function XDocument::OnSubmitRequest(eventObj)
{
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  // If the submit operation is successful, set
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  // eventObj.ReturnStatus = true;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  // Write your code here
} 

What code do I need to write in order for it to submit the data to the 
database and to print the form? And would this method verify if data was submitted to the database or not?&lt;/pre&gt;&lt;pre class="WNPost" style="WORD-WRAP:break-word;"&gt;I am using IP 2003 SP3.
&lt;/pre&gt;&lt;pre class="WNPost" style="WORD-WRAP:break-word;"&gt;Thanks for any help&lt;/pre&gt;</description></item></channel></rss>