javascript - Configure globalize.js to use CLDR for validating decimal numbers -


i need validate decimal numbers in serbian culture (a decimal separator comma instead of dot).

i looking on internet find solution , posts suggest use globalize.js. can set work me.

here code:

<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script> <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script> <script src="~/lib/cldrjs/dist/cldr.js"></script> <script src="~/lib/cldrjs/dist/cldr/event.js"></script> <script src="~/lib/cldrjs/dist/cldr/supplemental.js"></script> <script src="~/lib/globalize/dist/globalize.js"></script> <script src="~/lib/globalize/dist/globalize/number.js"></script>  <script> $.when(   $.get("/lib/cldr-data/supplemental/likelysubtags.json"),   $.get("/lib/cldr-data/main/sr/numbers.json"),   $.get("/lib/cldr-data/supplemental/numberingsystems.json") ).then(function () {   return [].slice.apply(arguments, [0]).map(function (result) {     return result[0];   }); }).then(globalize.load).then(function () {   globalize.locale("sr"); }); </script> 

this code placed on end of each page need validation. of course, load jquery in head tag.

when load page browser, there no error in console, decimal separator still dot.

asp.net 5 mvc6 generated input tag is:

  <input class="form-control input-validation-error" type="text" data-val="true" data-val-number="the field plaćanje must number." data-val-required="the plaćanje field required." id="payment" name="payment" value="0,00" aria-required="true" aria-invalid="true" aria-describedby="payment-error"> 


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -