You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joakim Olsson <ar...@lingonpaj.com> on 2009/01/11 12:34:19 UTC

Locale-aware decimal number validation

Hi,

I have a need for locale-aware number validation in my app (since Sweden
use comma as decimal-separator instead of dot) and therefor I created my
own DoubleTranslator and FloatTranslator that I contributed to the
TranslatorSource from my module.

Since it would have been nice to also have client validation working in
a locale-aware manner I decided to take it a step further. :-D

Please find attached a patch towards 5.0.19-SNAPSHOT which adds support
for both client- and server-side locale-aware number-validation.

I have the number of decimals fixed to two in the translators since I
need to use it for monetary input. This should be nice to be able to
configure per field in some way.

I have placed the regexp for the client-side validation in the
ValidationMessages.properties-file which might be the wrong place to
have it.

There is probably also a need to look at the regular expressions that
are currently setup to make sure that they are correct for the various
locales.

Best regards,
Joakim


Re: Locale-aware decimal number validation

Posted by Joakim Olsson <ar...@lingonpaj.com>.
Aaah...Great. Didn't even consider searching the JIRA before diving into
the tapestry-code. :-D

I attached my patch to the JIRA as well.

Regards,
Joakim


On Sun, 2009-01-11 at 14:36 +0100, Ulrich Stärk wrote:
> Joakim,
> 
> there has been quite some discussion on this already and there also 
> exists a JIRA issue for this. Maybe you want to contribute there: 
> https://issues.apache.org/jira/browse/TAP5-211 Please also sign up for 
> JIRA and vote for it.
> 
> Cheers,
> 
> Uli
> 
> Joakim Olsson schrieb:
> > Hi,
> > 
> > I have a need for locale-aware number validation in my app (since Sweden
> > use comma as decimal-separator instead of dot) and therefor I created my
> > own DoubleTranslator and FloatTranslator that I contributed to the
> > TranslatorSource from my module.
> > 
> > Since it would have been nice to also have client validation working in
> > a locale-aware manner I decided to take it a step further. :-D
> > 
> > Please find attached a patch towards 5.0.19-SNAPSHOT which adds support
> > for both client- and server-side locale-aware number-validation.
> > 
> > I have the number of decimals fixed to two in the translators since I
> > need to use it for monetary input. This should be nice to be able to
> > configure per field in some way.
> > 
> > I have placed the regexp for the client-side validation in the
> > ValidationMessages.properties-file which might be the wrong place to
> > have it.
> > 
> > There is probably also a need to look at the regular expressions that
> > are currently setup to make sure that they are correct for the various
> > locales.
> > 
> > Best regards,
> > Joakim
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Locale-aware decimal number validation

Posted by Ulrich Stärk <ul...@spielviel.de>.
Joakim,

there has been quite some discussion on this already and there also 
exists a JIRA issue for this. Maybe you want to contribute there: 
https://issues.apache.org/jira/browse/TAP5-211 Please also sign up for 
JIRA and vote for it.

Cheers,

Uli

Joakim Olsson schrieb:
> Hi,
> 
> I have a need for locale-aware number validation in my app (since Sweden
> use comma as decimal-separator instead of dot) and therefor I created my
> own DoubleTranslator and FloatTranslator that I contributed to the
> TranslatorSource from my module.
> 
> Since it would have been nice to also have client validation working in
> a locale-aware manner I decided to take it a step further. :-D
> 
> Please find attached a patch towards 5.0.19-SNAPSHOT which adds support
> for both client- and server-side locale-aware number-validation.
> 
> I have the number of decimals fixed to two in the translators since I
> need to use it for monetary input. This should be nice to be able to
> configure per field in some way.
> 
> I have placed the regexp for the client-side validation in the
> ValidationMessages.properties-file which might be the wrong place to
> have it.
> 
> There is probably also a need to look at the regular expressions that
> are currently setup to make sure that they are correct for the various
> locales.
> 
> Best regards,
> Joakim
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org