adding jquery validation after form created
Posted
by CoffeeCode
on Stack Overflow
See other posts from Stack Overflow
or by CoffeeCode
Published on 2010-03-20T12:57:00Z
Indexed on
2010/03/20
13:01 UTC
Read the original article
Hit count: 531
im using a jquery validation plugin
first i add the validation to the form:
$('#EmployeeForm').validate({
rules: {
"Employee.FirstName": "required",
"Employee.PatronymicName": "required",
"Employee.LastName": "required",
"Employee.BirthDay": { required: true, date: true }
},
messages: {
"Employee.FirstName": { required: "*" },
"Employee.PatronymicName": { required: "*" },
"Employee.LastName": { required: "*" },
"Employee.BirthDay": { required: "*", date: "00.00.00 format" }
}
});
and then latter a need to add validation rules to other form elements:
$('#Address_A.Phone1, #Address_A.Phone2, #Address_B.Phone1, #Address_B.Phone2').rules("add", {
digits: true,
messages: {
digits: "?????? ?????"
}
});
but i get an error: 'form' is null or not an object
i check, the form and all the elements in it are created before i add validation to it.
cant figer out whats wrong.
© Stack Overflow or respective owner