Integrate jquery-globalize into an ASP.NET Core MVC App -


in tutorial : building first asp.net core mvc app visual studio purpose build simple movie application. @ step adding model there note below :

note

you may not able enter decimal points or commas in price field. support jquery validation non-english locales use comma (”,”) decimal point, , non us-english date formats, must take steps globalize app. see additional resources more information. now, enter whole numbers 10.

but did not found in mentioned additionnal resources how integrate jquery date / decimal inputs when using non english locale.

this explain in tutorial : getting started asp.net mvc 5 @ step 7 examining edit methods , edit view (near end of page). same tutorial targeting asp.net mvc, not asp.net core mvc.

i tried follow same steps stuck because _layout view in asp.net core mvc tutorial cannot set same way in asp.net mvc tutorial.

do know how integrate jquery globalize js package asp.net core mvc web app ? or better can translate concern part of asp.net mvc tutorial asp.net core mvc way ?

after struggling many hours found solution (credits page http://www.tiselvagem.com.br/desenvolvimento/net/validacao-de-data-e-moeda-asp-net-mvc-jquery-validation-em-portugues/ in portuguese).

solution:

add methods_xx file (xx stands language project - in case methods_pt.js) , change _validationscriptspartial.cshtml file in views/shared folder include added file. in case:

<environment names="development">     <script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>     <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>     <script src="~/lib/jquery-validation/methods_pt.js"></script> </environment> <environment names="staging,production">     <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"         asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"         asp-fallback-test="window.jquery && window.jquery.validator"         crossorigin="anonymous"         integrity="sha384-fnqn3nxp3506lp/7y3j/25blwea3pxtyt1l78ljeccpakcv12tszp7yymxoe/g/k">     </script>     <script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"         asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"         asp-fallback-test="window.jquery && window.jquery.validator && window.jquery.validator.unobtrusive"         crossorigin="anonymous"         integrity="sha384-jrxk+k53hacyavukosl+nkmsesd2p+73edmrbtttk0h4rmof8hf8applkp26jlyh">     </script>         <script src="~/lib/jquery-validation/methods_pt.js"></script> </environment> 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -