Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change 
notification.

The following page has been changed by HubertRabago:
http://wiki.apache.org/struts/ShaleValidation

The comment on the change is:
Add tips on ordering <s:validatorVar> parameters.

------------------------------------------------------------------------------
  == Shale Commons Validator Integration ==
  
   * http://struts.apache.org/struts-shale/features-commons-validator
+ 
+ === Validation error messages and the <s:validatorVar> tag ===
+ 
+ The parameters used to format the 
[http://svn.apache.org/repos/asf/struts/shale/trunk/core-library/src/java/org/apache/shale/validator/messages.properties
 error messages] that are shown when a validation error occurs include the 
incorrect value and any validator-specific 'var' parameters.  
+ 
+ When the <s:validatorVar> tag is used for validator-specific 'var' 
parameters, the order in which the 'var's are declared is the order that will 
be used to format the error message.
+ 
+ For a 'range' validator, such as 'floatRange', the error message pattern is:
+ 
+ {{{errors.range={0} is not in the range {1} through {2}.}}}
+ 
+ Therefore, when using a "range" validator with the <s:validatorVar> tags, 
specify the "min" var before the "max" var:
+ 
+ {{{
+ <s:commonsValidator type="floatRange"
+                      arg="#{msgs.amount}"
+                   server="true" 
+                   client="false">
+     <s:validatorVar name="min" value="10"/>
+     <s:validatorVar name="max" value="1000"/>
+ </s:commonsValidator>
+ }}}
+ 
  
  === Using Custom Validation Rules with Shale ===
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to