in my page there are few hidden field which are filled with the correct value from a script. These fields are validated server side against code injection and others malicius attacks but I'd like to put some code to validate the fields also client-side. My aim is to request that field with name = "name1" and "name2" contain a string of two (not more not less) letters (not numbers) to submit the form. My problem is that for the others fields I am using jQuery Validation Plugin 1.9.0 but if the field is hidden the script doesn't work on it. I'm using the following code to tell validation which roles to follow:
$(document).ready(function(){ $("#myform").validate({ rules:{ my_hidden_field:{ required: true, minlength: 2, } }, messages:{ my_hidden_field: "this field is not valid" }, errorLabelContainer: "#BoxValidator", wrapper: "li", }); });