The point of having the mask validation is so we don't have to support all variations of patterns. I'm -1 on adding validators that duplicate what can already be done with mask.
David --- Niall Pemberton <[EMAIL PROTECTED]> wrote: > Robert, > > I tried to get mask to work (although until today I had no knowledge of > regular expressions) using the ORA demonstration applet and I couldn't > get > it to (including your suggestion). > > I'm not saying regular expressions couldn't work (only I don't know how > to > make them!), but the pattern's used in DecimalFormat are so much more > straight forward and designed for the task. Typically as people are > probably > using a pattern with DecimalFormat to output the data to screen, it then > is > much easier and intuitive to specify the same pattern for validation. > > I say horses for courses and to me using a number pattern to validate > numbers is a better way to do it - hence the enhacement request: > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26151 > > Thanks > > Niall > > > Robert Leland wrote: > > > > 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> > > 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. > > 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 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]