Niall - If you do add on to this patch to support JavaScript validations of numberFormats, there is probably some existing JavaScript code available that you can use. I would start by looking at Matt Kruse's JavaScript Date Functions, which you can find here:
http://www.mattkruse.com/javascript/date/ Matt ----- Original Message ----- From: "Niall Pemberton" <[EMAIL PROTECTED]> To: "Struts Developers List" <[EMAIL PROTECTED]> Sent: Friday, January 16, 2004 9:48 AM Subject: Re: Validating Formatted Numbers Patch [Bugzilla 26151] > OK hey, appreciate your feedback - and the mask/regexp gives me another > string to my bow! > > I do think using the DecimalFormat style patterns is much easier and > intuitive, but there is the issue > over JavaScript and there are issues with the DecimalFormat parse() method. > I think I need to > re-think this enhacement request so I'll drop it for the moment and perhaps > submit something different > at a later date. > > Niall > > ----- Original Message ----- > From: "David Graham" <[EMAIL PROTECTED]> > To: "Struts Developers List" <[EMAIL PROTECTED]> > Sent: Friday, January 16, 2004 1:46 PM > Subject: Re: Validating Formatted Numbers Patch [Bugzilla 26151] > > > > > > --- Niall Pemberton <[EMAIL PROTECTED]> wrote: > > > I agree with both of you! > > > > > > Not having JavaScript implementation shouldn't be an issue - if people > > > want > > > it then someone would come up with it. > > > > > > However, because the approach I took was to modify the exiting number > > > validations (byte, short, long, integer, float, double) then it means > > > that where there is JavaScript validation (not all of them seem to have) > > > these will now fail if a pattern is used, because they don't take into > > > account the pattern. > > > > > > I would put some additional time on this, if a committer was willing to > > > implement it. But since David Graham has said he is -1 on this, doesn't > > > that > > > effectively make this enhacement request dead? > > > > There wasn't a vote so my -1 is more of an indication that I don't like > > the idea. Mask is the most flexible validation that allows many things > > like formatted number validations. If you can't get your regex to work > > you might try writing a custom validation action that uses DecimalFormat. > > If that works you could post a patch to bugzilla. I encourage you to get > > the regex to work though because it will make life easier in the long run > > :-). > > > > David > > > > > > > > Niall > > > > > > > > > Richard Hightower wrote ... > > > > I agree about that sticky wicket, but.... > > > > > > > > There are already validation rules that do not have client-side > > > support > > > (via > > > > JavaScript). > > > > > > > > At least this type of stuff would be nice in the contrib area. > > > > > > > > > > Ted Husted wrote ... > > > > In principle, I'd agree with Rick, since these type of patterns are > > > the > > > > standard way of doing this sort of thing on the Java platform. > > > > > > > > But, the sticky wicket is lack of a JavaScript implementation. People > > > would > > > > expect an implementation like this to include client-side support, as > > > the > > > > other validations do. > > > > > > > > -Ted. > > > > > > > > > > > > On Thu, 15 Jan 2004 20:54:17 -0700, Richard Hightower wrote: > > > > > Niall, > > > > > > > > > > > > > > > I don't get a vote. I am not a committer. But if I did.... I would > > > > > vote +1 on the idea (I have not studied your implementation). I can > > > > > write regular expressions in a pinch, but why not support all of > > > > > the java.text.* in the validator rules (including currencey). I > > > > > like the idea. > > > > > > > > > > Rick Hightower > > > > > Developer > > > > > > > > > > > > > > > Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm > > > > > Struts/J2EE consulting -- http://www.arc- > > > > > mind.com/consulting.htm#StrutsMentoring > > > > > > > > > > -----Original Message----- > > > > > From: Niall Pemberton [mailto:[EMAIL PROTECTED] > > > > > Sent: Thursday, January 15, 2004 5:38 PM To: Struts Developers List > > > > > Subject: Re: Validating Formatted Numbers Patch [Bugzilla 26151] > > > > > > > > > > > > > > > OK so how can it be done with mask? > > > > > > > > > > > > > > > also, it doesn't get more basic than numbers...if it can be done > > > > > with mask, but its complicated, doesn't ease of use cut any ice? > > > > > > > > > > Niall > > > > > ----- Original Message ----- > > > > > From: "David Graham" <[EMAIL PROTECTED]> > > > > > To: "Struts Developers List" <[EMAIL PROTECTED]> Sent: > > > > > Thursday, January 15, 2004 10:19 PM > > > > > Subject: Re: Validating Formatted Numbers Patch [Bugzilla 26151] > > > > > > > > > > > > > > >> 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: struts-dev- > > > > >>> [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: struts-dev- > > > > >> [EMAIL PROTECTED] For additional commands, e-mail: > > > > >> [EMAIL PROTECTED] > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > === message truncated === > > > > > > __________________________________ > > 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] > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]