<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to Use onbeforeunload with Form Submit Buttons</title>
	<atom:link href="http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/feed/" rel="self" type="application/rss+xml" />
	<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/</link>
	<description>David Drake Covers Programming, Technology and Turbulence in Life</description>
	<lastBuildDate>Sat, 04 Feb 2012 20:52:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jeremy</title>
		<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/comment-page-1/#comment-112501</link>
		<dc:creator>Jeremy</dc:creator>
		<pubDate>Sat, 03 Dec 2011 22:36:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.ilovebonnie.net/?p=345#comment-112501</guid>
		<description>I see it took out the php code!

Where it says submitFormOkay I added a random number to the end with php.  

Create the random number:
$random = rand(5, 15);

...then just echo &quot;$random&quot; after each &quot;submitFormOkay&quot;  - you can do this in jquery too</description>
		<content:encoded><![CDATA[<p>I see it took out the php code!</p>
<p>Where it says submitFormOkay I added a random number to the end with php.  </p>
<p>Create the random number:<br />
$random = rand(5, 15);</p>
<p>&#8230;then just echo &#8220;$random&#8221; after each &#8220;submitFormOkay&#8221;  &#8211; you can do this in jquery too</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy</title>
		<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/comment-page-1/#comment-112500</link>
		<dc:creator>Jeremy</dc:creator>
		<pubDate>Sat, 03 Dec 2011 19:58:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.ilovebonnie.net/?p=345#comment-112500</guid>
		<description>I wanted a quick fix to the submit problem so used php:

var submitFormOkay = false;
window.onbeforeunload = function () {
    if (!submitFormOkay) {
        return &quot;You are about to leave this page. You will lose any information...&quot;;
    }
}


and on the button .... onclick=&quot;submitFormOkay = true;&quot;/&gt;</description>
		<content:encoded><![CDATA[<p>I wanted a quick fix to the submit problem so used php:</p>
<p>var submitFormOkay = false;<br />
window.onbeforeunload = function () {<br />
    if (!submitFormOkay) {<br />
        return &#8220;You are about to leave this page. You will lose any information&#8230;&#8221;;<br />
    }<br />
}</p>
<p>and on the button &#8230;. onclick=&#8221;submitFormOkay = true;&#8221;/&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keane Ingram</title>
		<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/comment-page-1/#comment-112467</link>
		<dc:creator>Keane Ingram</dc:creator>
		<pubDate>Wed, 02 Nov 2011 15:23:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.ilovebonnie.net/?p=345#comment-112467</guid>
		<description>Thanks for this, it&#039;s exactly what I needed and saved me a lot of time!</description>
		<content:encoded><![CDATA[<p>Thanks for this, it&#8217;s exactly what I needed and saved me a lot of time!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/comment-page-1/#comment-93936</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Wed, 25 May 2011 10:24:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.ilovebonnie.net/?p=345#comment-93936</guid>
		<description>Thanks man</description>
		<content:encoded><![CDATA[<p>Thanks man</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rak</title>
		<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/comment-page-1/#comment-90115</link>
		<dc:creator>rak</dc:creator>
		<pubDate>Fri, 06 May 2011 06:06:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.ilovebonnie.net/?p=345#comment-90115</guid>
		<description>This isn&#039;t totally correct. 

Because once you click &quot;form submit&quot; &amp; then try to leave page, it won&#039;t warn u. Because &quot;submitFormOkay&quot; is not set to false again. I&#039;ve been spending lot of time to solve that but still I couldn&#039;t find anything. Any solution would help a lot!</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t totally correct. </p>
<p>Because once you click &#8220;form submit&#8221; &amp; then try to leave page, it won&#8217;t warn u. Because &#8220;submitFormOkay&#8221; is not set to false again. I&#8217;ve been spending lot of time to solve that but still I couldn&#8217;t find anything. Any solution would help a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kvz</title>
		<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/comment-page-1/#comment-66241</link>
		<dc:creator>kvz</dc:creator>
		<pubDate>Mon, 31 Jan 2011 16:58:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.ilovebonnie.net/?p=345#comment-66241</guid>
		<description>Instead of using a global state variable, you could also unset the beforeunload instead:

        $form.submit(function() {
            window.onbeforeunload = null;
        });</description>
		<content:encoded><![CDATA[<p>Instead of using a global state variable, you could also unset the beforeunload instead:</p>
<p>        $form.submit(function() {<br />
            window.onbeforeunload = null;<br />
        });</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: banjer</title>
		<link>http://randomdrake.com/2009/09/23/how-to-use-onbeforeunload-with-form-submit-buttons/comment-page-1/#comment-21706</link>
		<dc:creator>banjer</dc:creator>
		<pubDate>Fri, 26 Mar 2010 02:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.ilovebonnie.net/?p=345#comment-21706</guid>
		<description>Thanks, works great!  I knew there was a simple solution to seeing whether or not a form was submitted.</description>
		<content:encoded><![CDATA[<p>Thanks, works great!  I knew there was a simple solution to seeing whether or not a form was submitted.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.493 seconds -->

