Hi,
I am having some issues in performing validations on grid columns-
1. The built in validations are not working
2. By default, only the first editable field from left has required field validation with message as 'At least one field must be updated'. How can I change the message?
3. I am trying to put a custom validator.
In <head> section of cshtml page i have written this script-
<script src="../../Scripts/jquery-1.10.2.js"></script>
<script src="../../Scripts/jquery.validate.js"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.js"></script>
<script type="text/javascript">
$(function () {
console.log($);
console.log($.validator);
$.validator.addMethod("customValidatorRequiredField", function (value, element, params) {
return !(element.value == '' || element.value == null || element.value == undefined);
}, "Required Field");
});
</script>
But I am getting error in console as "Cannot read property 'addMethod' of undefined"
The outputs of console.logs are as follows-
console.log($); - ƒ ( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
}
console.log($.validator); - undefined
I guess its unable to find 'validator'. I have included required script files in the page-
jquery-1.10.2.js,
jquery.validate.js,
jquery.validate.unobtrusive.js
Could you please help me with the above issues? I have attached the .cshtml file for your reference.
Regards,
Kaushik
Attachment:
Admin_acca0621.7z