jquery-validate

jquery validation plugin - not validating on submit

风格不统一 提交于 2021-01-20 12:48:46
问题 I've got a form with several fields, some of which I'd like to have validated on keyup and on submit. I am calling jquery 1.9.1 then the plugin (1.11.1), then an external file with my js. I see via Firebug they are all loading. If I use the code below, it does not validate at all - the form submits, and I get mysql errors because I don't have fields filled out. Here is the js code: $("#untForm").validate({ onfocusout: true, rules: { attachment: { required: "false", accept: "jp?g,png,gif,txt"

Check if field is required?

半世苍凉 提交于 2021-01-20 12:37:32
问题 I need to find all required fields in given form using jquery. I was using this syntax: $('input[required],select[required]') This was doing job, but now I started using jQuery Validation Plugin. As i understood plugin would not add 'required' attribute to field, and thats why above script is failing to find required fields. Is it possible select required field when using jQuery Validation Plugin? 回答1: As I understood plugin would not add 'required' attribute to field, and thats why above

Check if field is required?

雨燕双飞 提交于 2021-01-20 12:36:08
问题 I need to find all required fields in given form using jquery. I was using this syntax: $('input[required],select[required]') This was doing job, but now I started using jQuery Validation Plugin. As i understood plugin would not add 'required' attribute to field, and thats why above script is failing to find required fields. Is it possible select required field when using jQuery Validation Plugin? 回答1: As I understood plugin would not add 'required' attribute to field, and thats why above

jquery validator: how to pass form errors reported from server [duplicate]

妖精的绣舞 提交于 2021-01-20 12:11:41
问题 This question already has answers here : jQuery Validate remote method usage to check if username already exists (2 answers) jQuery - remote validation rule (1 answer) Closed 22 days ago . I have a simple login form with first_name , last_name and username password and confirm_password FORM_RULES ={ "first_name": { "required": true, "max_length": 30 }, "last_name": { "required": true, "max_length": 30 }, "username": { "required": true, "max_length": 150 }, password: { "required": true,

Validate elements on click but select element validation fires too early

放肆的年华 提交于 2020-12-27 06:10:52
问题 I have installed the jQuery validate plugin and have set the form to validate on click of each element. This works great except for select fields, they seem to fire too early because it is on click. Is there a way to stop the select elements from firing the validation until they have chosen an option? Here is my set up $.validator.setDefaults({ highlight: function (e) { $(e).closest('.questionWrap').addClass('error'); $(e).closest('.questionWrap').find('.questionTitle').removeClass(

Validate elements on click but select element validation fires too early

半世苍凉 提交于 2020-12-27 06:09:09
问题 I have installed the jQuery validate plugin and have set the form to validate on click of each element. This works great except for select fields, they seem to fire too early because it is on click. Is there a way to stop the select elements from firing the validation until they have chosen an option? Here is my set up $.validator.setDefaults({ highlight: function (e) { $(e).closest('.questionWrap').addClass('error'); $(e).closest('.questionWrap').find('.questionTitle').removeClass(

Validate elements on click but select element validation fires too early

只愿长相守 提交于 2020-12-27 06:08:02
问题 I have installed the jQuery validate plugin and have set the form to validate on click of each element. This works great except for select fields, they seem to fire too early because it is on click. Is there a way to stop the select elements from firing the validation until they have chosen an option? Here is my set up $.validator.setDefaults({ highlight: function (e) { $(e).closest('.questionWrap').addClass('error'); $(e).closest('.questionWrap').find('.questionTitle').removeClass(