click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1033336 - /click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java
Date Wed, 10 Nov 2010 02:56:33 GMT
Author: sabob
Date: Wed Nov 10 02:56:33 2010
New Revision: 1033336

URL: http://svn.apache.org/viewvc?rev=1033336&view=rev
Log:
register Form explicitly

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

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java?rev=1033336&r1=1033335&r2=1033336&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java
(original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java
Wed Nov 10 02:56:33 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.Field;
 import org.apache.click.control.Form;
@@ -56,13 +57,15 @@ public class SimpleFormAjaxPage extends 
             }
         });
 
-        // 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 ok Submit
-        // 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