You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2005/05/31 17:23:37 UTC

svn commit: r179222 - in /struts/shale/trunk: core-library/src/java/org/apache/shale/component/ValidatorScript.java use-cases/src/web/validator/test.jsp

Author: dgeary
Date: Tue May 31 08:23:36 2005
New Revision: 179222

URL: http://svn.apache.org/viewcvs?rev=179222&view=rev
Log:
Patch submitted by Manfred Klug to set the required attribute only for server-side validation and to properly test that feature in the use case

Modified:
    struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java
    struts/shale/trunk/use-cases/src/web/validator/test.jsp

Modified: struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java?rev=179222&r1=179221&r2=179222&view=diff
==============================================================================
--- struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java (original)
+++ struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java Tue May 31 08:23:36 2005
@@ -106,24 +106,25 @@
          for (int i = 0; i < vs.length; i++) {
             if (vs[i] instanceof CommonsValidator) {
                CommonsValidator v = (CommonsValidator) vs[i];
-               if (!Boolean.FALSE.equals(v.getClient())) {
+               if (Boolean.TRUE.equals(v.getClient())) {
                   String id = c.getClientId(context);
                   addValidator(v.getType(), id, v);
 
-                  // Fields with empty values are not validated, so
-                  // we force the issue here by setting the component's
-                  // required attribute to true.
-
-                  if("required".equals(v.getType())) {
-                     h.setRequired(true);   
-                  }
-
                   ValidatorAction action = v.getValidatorAction();
                   List list = action.getDependencyList();
                   Iterator iter = list.iterator();
                   while (iter.hasNext()) {
                      String type = (String) iter.next();
                      addValidator(type, id, v);
+                  }
+               }
+               if (Boolean.TRUE.equals(v.getServer())) {
+                  // Fields with empty values are not validated, so
+                  // we force the issue here by setting the component's
+                  // required attribute to true.
+
+                  if("required".equals(v.getType())) {
+                     h.setRequired(true);   
                   }
                }
             }

Modified: struts/shale/trunk/use-cases/src/web/validator/test.jsp
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/validator/test.jsp?rev=179222&r1=179221&r2=179222&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/web/validator/test.jsp (original)
+++ struts/shale/trunk/use-cases/src/web/validator/test.jsp Tue May 31 08:23:36 2005
@@ -75,8 +75,7 @@
       <h:panelGroup>
          <h:inputText     id="creditCard"
                         size="11"
-                       value="#{validate$test.creditCard}"
-                    required="true">
+                       value="#{validate$test.creditCard}">
 
             <s:commonsValidator 
                         type="required"



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