click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1041288 - /click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java
Date Thu, 02 Dec 2010 06:37:07 GMT
Author: sabob
Date: Thu Dec  2 06:37:07 2010
New Revision: 1041288

URL: http://svn.apache.org/viewvc?rev=1041288&view=rev
Log:
explicitly register form makes intention clear

Modified:
    click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java?rev=1041288&r1=1041287&r2=1041288&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java
Thu Dec  2 06:37:07 2010
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.List;
 import org.apache.click.Control;
 import org.apache.click.ActionResult;
+import org.apache.click.ControlRegistry;
 import org.apache.click.ajax.DefaultAjaxBehavior;
 import org.apache.click.control.Form;
 import org.apache.click.control.Submit;
@@ -77,13 +78,15 @@ public class AdvancedFormAjaxPage extend
             }
         });
 
-        // NOTE: we add a Behavior to Form so that Click registers the Form as an Ajax target
-        // ALSO NOTE: we don't implement the onAction method as the save and cancel Submits
-        // handles the Behavior action event
-        form.addBehavior(new DefaultAjaxBehavior());
-
-        // Instead of adding a behavior, the same can be achived by explicitly registering
the Form as an Ajax Target:
-        // ControlRegistry.registerAjaxTarget(form);
+        // NOTE: we explicitly register the Form as an Ajax target so that the
+        // Fom#onProcess method can be invoked. The save button's Behavior will
+        // still handle the request though
+        ControlRegistry.registerAjaxTarget(form);
+
+        // Instead of explicitly registering the Form, the same can be achived by
+        // adding an empty Behavior to the Form so that Click register the Form
+        // as an Ajax target:
+        // form.addBehavior(new DefaultAjaxBehavior());
     }
 
     /**



Mime
View raw message