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>

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




Reply via email to