Niall Pemberton wrote:

I need to validate numbers which are formatted and have posted a patch to bugzilla which enhances validator the existing number validations to do this.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26151

This patch allows an optional "numberPattern" variable to be specified for the existing byte, short, integer, long, float and double validations. For Example:

<field property="amount" depends="required,integer">
<arg0 key="sale.amount" />
<var>
<var-name>numberPattern</var-name>
<var-value>#,##0:(#,##0)</var-value>
</var>
</field>


So using mask won't work ? (my syntax below is probably not correct)

<field property="amount" depends="required,mask">
   <arg0 key="sale.amount" />
   <var>
         <var-name>mask</var-name>
         <var-value>\d,\d\d0\:\(\d,\d\d0\)</var-value>
   </var>
</field>


If the pattern is specified, then java.text.DecimalFormat is used to parse the number and check if it is valid (catering for Locale).

I have also posted a patch to add a new section the Validator User Guide which describes all the standard suppiled validations and shows examples of usage, including using the new "numberPattern" variable.

Thanks in advance for any feedback.

Niall










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



Reply via email to