Author: artdaw
Date: 2007-11-22 10:12:31 -0500 (Thu, 22 Nov 2007)
New Revision: 4186
Modified:
trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml
Log:
RF-1280 - add Usage for 'oncomplete' attribute
Modified: trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml 2007-11-22
15:04:31 UTC (rev 4185)
+++ trunk/docs/userguide/en/src/main/docbook/included/commandButton.xml 2007-11-22
15:12:31 UTC (rev 4186)
@@ -56,14 +56,42 @@
<note>
<title>Note:</title>
<para>AJAX support is built in and it's not necessary to add nested
<emphasis
role="bold"><property><a4j:support></property></emphasis>
to the component.</para>
- </note>
+ </note>
+ <para>
+ The usage of the keyword 'this' in JavaScript code in the
<emphasis><property>"oncomplete"</property></emphasis>
attribute
+ depends on the location of <emphasis
role="bold"><property><a4j:commandButton></property></emphasis>.
If the <property>commandButton</property> is situated outside the re-rendered
region
+ you can use keyword 'this' as in the following example:
+ </para>
+ <programlisting role="JAVA"><![CDATA[
+...
+<h:form id="form">
+ <a4j:commandButton id="cbutton" action="director.rollCamera"
+ onclick="this.disabled=true"
+ oncomplete="this.disabled=false" />
+</h:form>
+...
+]]></programlisting>
+ <para>
+ Otherwise if the <property>commandButton</property> contained in
re-rendered region
+ the
<emphasis><property>"oncomplete"</property></emphasis>
attribute has a problem obtaining a reference of the
<property>commandButton</property> object
+ when using the keyword 'this'. In this case you can use the
<emphasis><property>"oncomplete"</property></emphasis>
attribute as in the following example:
+ </para>
+ <programlisting role="JAVA"><![CDATA[
+...
+<h:form id="form">
+<a4j:commandButton id="cbutton" action="director.rollCamera"
+ onclick="this.disabled=true"
+
oncomplete="document.getElementById('form:cbutton').disabled=false"
/>
+</h:form>
+...
+]]></programlisting>
<para>Common JSF navigation could be performed after an Ajax submit and partial
rendering, but Navigation Case must be defined as <emphasis
role="bold"><property><redirect/></property></emphasis>
in order to avoid problems with some browsers.</para>
<para>As any Core Ajax component sending Ajax requests and processing server
responses <emphasis
role="bold"><property><a4j:commandButton></property></emphasis>
has all attributes described above (see <emphasis
role="bold"><property><a4j:support></property></emphasis>
chapter) that provide the required behavior of requests sending (delay, limitation of
submit area and rendering, and etc.)</para>
</section>
<section>
<title>Relevant resources links</title>
<para>
- <ulink
url="http://livedemo.exadel.com/richfaces-demo/richfaces/commandButt....
+ <ulink
url="http://livedemo.exadel.com/richfaces-demo/richfaces/commandButt...
</ulink>you can see the example of <emphasis role="bold"
<property><a4j:commandButton></property></emphasis>
usage and sources for the given example.
</para>