У меня очень большой проект, который использует правила проверки по умолчанию, определенные в jquery плагине проверки. Моя проблема в том, что я хочу переопределить мои проверки для конкретной формы c в проекте, ниже приведен мой код, но он не привязывает его к форме. Мы будем благодарны за любую помощь.
$('form.customer-info-form').validate({
rules: {
dwfrm_singleshipping_shippingAddress_email_emailAddress: {
required: true,
email: true
},
dwfrm_singleshipping_shippingAddress_addressFields_firstName:{
requred:true
},
dwfrm_singleshipping_shippingAddress_addressFields_lastName: {
required: true
},
dwfrm_singleshipping_shippingAddress_addressFields_address1: {
required: true
},
dwfrm_singleshipping_shippingAddress_addressFields_city: {
required: true
},
dwfrm_singleshipping_shippingAddress_addressFields_states_state: {
required: true
},
dwfrm_singleshipping_shippingAddress_addressFields_postal: {
required: true
},
dwfrm_singleshipping_shippingAddress_addressFields_phone: {
required: true
}
},
messages: {
dwfrm_singleshipping_shippingAddress_addressFields_firstName: Resources.VALIDATE_FIRSTNAME,
dwfrm_singleshipping_shippingAddress_addressFields_lastName: Resources.VALIDATE_LASTNAME,
dwfrm_singleshipping_shippingAddress_email_emailAddress: {
required: "Email is required",
dwfrm_singleshipping_shippingAddress_email_emailAddress: Resources.VALIDATE_EMAIL
},
dwfrm_singleshipping_shippingAddress_addressFields_address1: Resources.VALIDATE_ADDRESS1,
dwfrm_singleshipping_shippingAddress_addressFields_city: Resources.VALIDATE_CITY,
dwfrm_singleshipping_shippingAddress_addressFields_states_state: Resources.VALIDATE_STATE,
dwfrm_singleshipping_shippingAddress_addressFields_postal: Resources.VALIDATE_POSTAL,
dwfrm_singleshipping_shippingAddress_addressFields_phone:Resources.VALIDATE_PHONE
},
highlight: function(element) {
$(element).parents('.form-group').addClass('has-error');
},
errorElement: 'span',
errorClass: 'validation-error-message help-block form-helper bold',
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
},
submitHandler: function(form) {
form.submit();
}
});
Здесь Resources.VALIDATE_FIRSTNAME
et c - переменные, в которых хранятся сообщения об ошибках.