You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bw...@apache.org on 2006/04/22 09:22:22 UTC

svn commit: r396090 - /tapestry/tapestry4/branches/branch-3-0/framework/src/org/apache/tapestry/valid/ValidField.java

Author: bwallace
Date: Sat Apr 22 00:22:20 2006
New Revision: 396090

URL: http://svn.apache.org/viewcvs?rev=396090&view=rev
Log:
[TAPESTRY-215] Added check for isDisabled() before trying to add code to set focus and validator

Modified:
    tapestry/tapestry4/branches/branch-3-0/framework/src/org/apache/tapestry/valid/ValidField.java

Modified: tapestry/tapestry4/branches/branch-3-0/framework/src/org/apache/tapestry/valid/ValidField.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/branches/branch-3-0/framework/src/org/apache/tapestry/valid/ValidField.java?rev=396090&r1=396089&r2=396090&view=diff
==============================================================================
--- tapestry/tapestry4/branches/branch-3-0/framework/src/org/apache/tapestry/valid/ValidField.java (original)
+++ tapestry/tapestry4/branches/branch-3-0/framework/src/org/apache/tapestry/valid/ValidField.java Sat Apr 22 00:22:20 2006
@@ -82,21 +82,22 @@
 
         boolean rendering = !cycle.isRewinding();
 
-        if (rendering)
+        if (rendering && !isDisabled())
             delegate.writePrefix(writer, cycle, this, validator);
 
         super.renderComponent(writer, cycle);
 
-        if (rendering)
-            delegate.writeSuffix(writer, cycle, this, validator);
-
-        // If rendering and there's either an error in the field,
-        // then we may have identified the default field (which will
-        // automatically receive focus).
-
-        if (rendering && delegate.isInError())
-            addSelect(cycle);
-
+        if (!isDisabled()) {
+            if (rendering)
+                delegate.writeSuffix(writer, cycle, this, validator);
+
+            // If rendering and there's either an error in the field,
+            // then we may have identified the default field (which will
+            // automatically receive focus).
+
+            if (rendering && delegate.isInError())
+                addSelect(cycle);
+        }
         // That's OK, but an ideal situation would know about non-validating
         // text fields, and also be able to put the cursor in the
         // first field, period (even if there are no required or error fields).
@@ -111,6 +112,10 @@
 
     protected void beforeCloseTag(IMarkupWriter writer, IRequestCycle cycle)
     {
+        if (isDisabled()) {
+            return;
+        }
+        
         IValidator validator = getValidator();
 
         validator.renderValidatorContribution(this, writer, cycle);
@@ -167,7 +172,7 @@
         Object value = getValue();
         String result = getValidator().toString(this, value);
 
-        if (Tapestry.isBlank(result) && getValidator().isRequired())
+        if (Tapestry.isBlank(result) && getValidator().isRequired() && !isDisabled())
             addSelect(getPage().getRequestCycle());
 
         return result;



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org