<?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: Close event in InfoPath 2007???</title><link>https://www.infopathdev.com:443/forums/thread/88217.aspx</link><pubDate>Wed, 20 Mar 2013 15:36:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:88217</guid><dc:creator>Bo Clarence Shizzle III</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/88217.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=88217</wfw:commentRss><description>&lt;p&gt;I have this same concern.&amp;nbsp; I want users to be prompted if they&amp;#39;ve entered data / changed the form if they want to save their changes when they click any close button. Whether it&amp;#39;s a button in the form or on InfoPath.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Also, I have a close button in my form with the &amp;quot;Close the Form&amp;quot;&amp;nbsp;action running when it&amp;#39;s clicked, and I have the checkbox saying &amp;quot;If changes have not been saved, prompt the user to save&amp;quot; ticked, however that prompt is not showing up when users click the close button.&lt;/p&gt;&lt;p&gt;Any Ideas?&amp;nbsp; The ideal solution would be a simple close button in the form that does just that but prompts users to save if they&amp;#39;ve entered any data/changed any data on an opened form.&amp;nbsp; And the same behavior if using the close button on Infopath.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: I had removed the ability to Submit the form under Tools &amp;gt; Submit Options and unchecked the &amp;quot;Allow users to submit this form&amp;quot; check box.&amp;nbsp; To minimize confusion, we wanted a button labeled &amp;quot;save&amp;quot; in the form itself that would submit new forms to the SharePoint library as well as save over/update any changes to forms already in the library.&amp;nbsp; When unchecking &amp;quot;allow users to submit the form&amp;quot; it removes the Prompt users if they want to save changes functionality even if the close button has the &amp;quot;If changes have not been saved, prompt the user to save&amp;quot; check box ticked in the &amp;quot;close the form&amp;quot; action.&lt;br /&gt;This is just an update. It doesn&amp;#39;t resolve the issue.&lt;/p&gt;</description></item><item><title>Re: Close event in InfoPath 2007???</title><link>https://www.infopathdev.com:443/forums/thread/63612.aspx</link><pubDate>Thu, 27 Jan 2011 13:52:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63612</guid><dc:creator>HamishAhern</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63612.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63612</wfw:commentRss><description>&lt;p&gt;I too have the same concern, where is the close event in InfoPath 2007 so I can force the user to save.&lt;br /&gt;&lt;br /&gt;did anybody find a solution to his yet?&amp;nbsp;&amp;nbsp; I made a solution:&lt;/p&gt;1) Use windows API to disable the form close button...&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://social.msdn.microsoft.com/Forums/en/sharepointinfopath/thread/257f186f-3ab3-4ac4-9553-f71d100ad297"&gt;http://social.msdn.microsoft.com/Forums/en/sharepointinfopath/thread/257f186f-3ab3-4ac4-9553-f71d100ad297&lt;/a&gt;&lt;br /&gt;2) Disable the toolbars using code from google..&lt;br /&gt;3) put a button on the form for the user to close the app&lt;br /&gt;4)&amp;nbsp; use Application.Exit() to quit InfoPath.&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; btnExit_Clicked(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;ClickedEventArgs&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;// your save code here.&lt;br /&gt;&lt;br /&gt;//re-enable toolbars before you exit&lt;br /&gt;HideAllToolbars(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;true&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;br /&gt;//Exit App&lt;br /&gt;Application.Quit();&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; HideAllToolbars(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; flag)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;&lt;/p&gt;CommandBars&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; myCommandBars = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Application.ActiveWindow.CommandBars &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;CommandBars&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;CommandBar&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; myCommandBar = (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Application.ActiveWindow.CommandBars &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;CommandBars&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).ActiveMenuBar;&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;foreach&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;CommandBar&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; item &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; myCommandBars)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;//MessageBox.Show(item.Name.ToString() + &amp;quot; &amp;quot; + item.Type.ToString() + &amp;quot; &amp;quot; + item.Index.ToString());&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (flag == &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;true&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp;&amp;amp; (item.Type == &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;MsoBarType&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.msoBarTypeMenuBar || item.Type == &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;MsoBarType&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.msoBarTypeNormal))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;item.Enabled = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Close event in InfoPath 2007???</title><link>https://www.infopathdev.com:443/forums/thread/31547.aspx</link><pubDate>Tue, 19 Aug 2008 22:03:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31547</guid><dc:creator>arduk</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31547.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=31547</wfw:commentRss><description>&lt;p&gt;Thanks for getting back to me.&lt;br /&gt;&lt;br /&gt;I am aware that you can control this with a button, however even&amp;nbsp;if you put a button on, this doesn&amp;#39;t stop a user from using the Close button at the top right of the window instead of the button, which will then cause them to lose all of their data without being prompted to Save.&lt;br /&gt;&lt;br /&gt;Can anyone confirm that there is no close event on a form? Or am have I been looking in the wrong place?&lt;br /&gt;&lt;br /&gt;Thanks in advance!!&lt;/p&gt;</description></item><item><title>Re: Close event in InfoPath 2007???</title><link>https://www.infopathdev.com:443/forums/thread/31534.aspx</link><pubDate>Tue, 19 Aug 2008 13:48:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31534</guid><dc:creator>srikrushna</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31534.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=31534</wfw:commentRss><description>&lt;p&gt;You can more precisely control the close event by defining a Rule on a Button.&lt;/p&gt;
&lt;p&gt;Add the Action &amp;quot;Close the Form&amp;quot; and tick the Checkbox saying &amp;quot;If changes have not been saved, prompt the user to save&amp;quot;.This will ask the user if any changes done in the form.&lt;/p&gt;</description></item><item><title>Close event in InfoPath 2007???</title><link>https://www.infopathdev.com:443/forums/thread/31404.aspx</link><pubDate>Wed, 13 Aug 2008 04:50:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31404</guid><dc:creator>arduk</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31404.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=31404</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m sorry if this is a really simple question, but I can&amp;#39;t seem to find how to implement an onclose event for an Infopath client form.&lt;br /&gt;&lt;br /&gt;I would expect this would be fired if a user closed the form (or the infopath client)?&lt;br /&gt;&lt;br /&gt;My problem is that I want to prompt users to save if the form is dirty and they exit Infopath (eg by using File-&amp;gt;exit infopath, or by using the close X button at the top right of the infopath window)&lt;br /&gt;&lt;br /&gt;Any help on this greatly appreciated.&lt;br /&gt;&lt;br /&gt;Thanks in advance!&lt;/p&gt;</description></item></channel></rss>