<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments for Halfslide Design</title>
	<link>http://www.halfslide.com/blog</link>
	<description>...because Wholeslide would have just sounded silly</description>
	<pubDate>Thu, 20 Nov 2008 01:32:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>Comment on Prevent multiple clicks on ajax4jsf command button by Sergey Smirnov</title>
		<link>http://www.halfslide.com/blog/2007/08/14/prevent-multiple-clicks-on-ajax4jsf-command-button/#comment-2</link>
		<author>Sergey Smirnov</author>
		<pubDate>Wed, 15 Aug 2007 00:21:17 +0000</pubDate>
		<guid>http://www.halfslide.com/blog/2007/08/14/prevent-multiple-clicks-on-ajax4jsf-command-button/#comment-2</guid>
		<description>Unless you met the miracle, this code should not work.
oncomplete is invoked asynchronously. Actually, its invocation is delegated to the XMLHTTPRequest object. So, at the moment of invocation, 'this' references to XMLHTTPRequest object,  but not to the button.

The following code should work:
onclick="window.mybtn=this;mybtn.disabled=true"
oncomplete="mybtn.disabled=false"

This is as simple as possible. The global variable is used. If the button is inside any iterator you need to avoid re-definition using more 'sophisticated' code. However, the idea is the same - saving the reference to the object and then using it.</description>
		<content:encoded><![CDATA[<p>Unless you met the miracle, this code should not work.<br />
oncomplete is invoked asynchronously. Actually, its invocation is delegated to the XMLHTTPRequest object. So, at the moment of invocation, &#8216;this&#8217; references to XMLHTTPRequest object,  but not to the button.</p>
<p>The following code should work:<br />
onclick=&#8221;window.mybtn=this;mybtn.disabled=true&#8221;<br />
oncomplete=&#8221;mybtn.disabled=false&#8221;</p>
<p>This is as simple as possible. The global variable is used. If the button is inside any iterator you need to avoid re-definition using more &#8217;sophisticated&#8217; code. However, the idea is the same - saving the reference to the object and then using it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
