I am using jQuery Globalize plugin along with jQuery validation.
For the valid swedish number 5.000,00
parseFloat function gives NaN
What could be the bug in below code/library?
<script type="text/javascript" src="/Scripts/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="/Scripts/globalize.js"></script>
<script type="text/javascript" src="/Scripts/cultures/globalize.culture.sv.js"></script>
<script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
<script type="text/javascript" src="/Scripts/jquery.validate.unobtrusive.js" ></script>
<script type="text/javascript">
jQuery(function () {
Globalize.culture('sv');
$.validator.methods.number = function (value, element) {
if (Globalize.parseFloat(value)) { // this gives NaN
return true;
}
return false;
}
});
</script>
Sweden actually use space as thousand delimiter. I cant find a really good reference for it though. (I am Swedish and 1 000 000,123 looks better to me than 1.000.000,123)
the following .NET C# Code seams to confirm it.
Also if you go to 'Region and language' and then 'additional settings' in windows and select Swedish (Sweden) it shows Digit grouping symbol as a space.
And oracle seams to agree: http://docs.oracle.com/cd/E19455-01/806-0169/overview-9/index.html