3
votes

I have a JSP page, which accepts user strings in more than 23 languages. So an English speaking user writes 8.5, and the JavaScript function should accept it as well as the input 8,5 from a Russian user.

In this scenario, how do we validate the input in JavaScript for all the languages?

1
My idea is first get the locale value then the number format value and then validate with user input and if matches return appropriate vale.I think I need a snippet for this .GustyWind

1 Answers

2
votes

You can probably do this server side with Java using java.text.NumberFormat, but Dojo has code to do this client side. See dojo.number and dijit.form.NumberTextBox which uses dojo.number.