commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hasan Turksoy" <>
Subject [validator] locale aware validator scripts required
Date Thu, 15 Feb 2007 11:32:51 GMT

i've looked through issues but got no result...

does anybody has locale related issues about validator javascripts?
when the locale is EN: thousand seperator="," ,  decimal seperator='.'
(like: 123,45.67)
 when the locale is TR(my case): thousand seperator="." ,  decimal
seperator=',' (like: 123.45,67)

as far as i can see, validator javascripts written for EN locale in mind..
so, validator scripts are not working properly for my situation...

for example, for the above value, validateFloat will split my number after

as a workaround solution; i changed shale.jar).. it
assigns current locale's decimal and thousand seperator into two global
javascript variables..
resolting code is like below:
var localeSpecificThousandSeperator = '.';
var localeSpecificDecimalSeperator = ',';

and validators those want to validate seperator related values can use these

example validateFloat implementation code will then be like:
var tempArray = value.split(*localeSpecificDecimalSeperator*);
instead of
 var tempArray = value.split(*'.'*);

are there any other solutions exist? other suggestions? or can i use some
attributes of commons-validator components to overcome this issue..?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message