Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I allow period and comma as valid decimal point separators for floats?

I would like to allow both "123.45" and "123,45" as valid decimal inputs but currently "123.45" results in "The value '123.45' is not valid for Foo".

like image 550
randomguy Avatar asked Jul 22 '10 21:07

randomguy


1 Answers

You have to use Globalization. Globalization allows you to customize your numeric inputs for different locales. Have a look at the following article:

Globalizing ASP.NET MVC Client Validation
http://haacked.com/archive/2010/05/10/globalizing-mvc-validation.aspx

like image 117
Robert Harvey Avatar answered Oct 02 '22 21:10

Robert Harvey