I am from argentina, and I have been struggling with this problem for a long time, we use "," as a decimal separator, if you write "comma", javascript check fails, but if you put ".", The model will take a number converted to an integer (55.60 will be 5560)
I solved this problem with this simple solution:
1st - I updated the jquery validation libraries using the new cdn addresses: http://jqueryvalidation.org/
The links that I included in my javascript are as follows:
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/additional-methods.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/additional-methods.min.js"></script>
and if you want it to be in a specific language (in my case, Spanish), add this line as well:
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/localization/messages_es.js"></script>
Replace ES with the language you want.
2nd - If you want the numeric keypad to be decimal, you must replace ".". with "," to work correctly, add this code to your page to do this automatically:
$('#txtCurrency').keyup(function () { $('#txtCurrency').val($('#txtCurrency').val().replace(/\./g, ',')); });
Presto, the problem is resolved.
Bye
Yogurtu Jul 12 '14 at 22:35 2014-07-12 22:35
source share