I am sorry for my simple question but I can't get it work . How I can make this jquery validator method to work globally . I have this code in my layout:
jQuery.validator.methods.number = function (value, element) {
return this.optional(element) || !isNaN(Globalize.parseFloat(value));
};
jQuery(document).ready(function () {
jQuery(function () {
Globalize.culture("ro-RO");
});
});
But this is not working in my partial views so to make this code to work I have to put this in all my partial views ...
<script src="@Url.Content("~/Scripts/Common/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Common/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
<script>
jQuery.validator.methods.number = function (value, element) {
return this.optional(element) || !isNaN(Globalize.parseFloat(value));
};
jQuery(document).ready(function () {
jQuery(function () {
Globalize.culture("ro-RO");
});
});
</script>
@using (Ajax.BeginForm("CreateSemifabricat_AddResourceToProduct", "Product", null,
new AjaxOptions{
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
}, new { id = "addResToProd" }))
{
<input type="submit" value"Submit"/>
}
So my question is how can I make this code to work globally? Thanks!