click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r761075 - /incubator/click/trunk/click/framework/src/org/apache/click/control/Field.java
Date Wed, 01 Apr 2009 21:48:28 GMT
Author: sabob
Date: Wed Apr  1 21:48:28 2009
New Revision: 761075

URL: http://svn.apache.org/viewvc?rev=761075&view=rev
Log:
fixed CLK-508 when used with autobinding

Modified:
    incubator/click/trunk/click/framework/src/org/apache/click/control/Field.java

Modified: incubator/click/trunk/click/framework/src/org/apache/click/control/Field.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/control/Field.java?rev=761075&r1=761074&r2=761075&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/control/Field.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/control/Field.java Wed Apr
 1 21:48:28 2009
@@ -929,6 +929,12 @@
      * <li>the Field's Form is submitted. This method invokes
      * {@link Form#isFormSubmission()} to check if the Form is submitted or not
      * </li>
+     * <li>the method {@link #getForm()} returns null, meaning the Field is
+     * not added to a Form but to a different Container.
+     * </li>
+     * <li>the Field is added directly to the Page, for example through
+     * autobinding
+     * </li>
      * <li>the request is an Ajax request. This method invoked
      * {@link org.apache.click.Context#isAjaxRequest()} to check if the request
      * is an Ajax request or not
@@ -939,15 +945,23 @@
      * false otherwise
      */
     protected boolean canProcess() {
-        // An Ajax request forces the Field to process itself. Otherwise, if
-        // the Form is not submitted, an Ajax request targeting this field won't
-        // be processed.
+        // This method should return true for Ajax requests. Otherwise,
+        // if the Form is not submitted, an Ajax request targeting this field
+        // won't be processed.
         if (getContext().isAjaxRequest()) {
             return true;
         }
 
         Form form = getForm();
         if (form != null) {
+
+            // If the Field was added to both Form and Page (normally via
+            // autobinding), return true in order for the field to be processed
+            Page page = getPage();
+            if (page != null && page.getModel().containsKey(getName())) {
+                return true;
+            }
+
             return form.isFormSubmission();
         } else {
             return true;



Mime
View raw message