[jquery.validate plugin] remote question.
Hello all,
Would it be possible to do a remote check on every element upon a submit?
pastebin code of my php validation script: http://pastebin.com/QX2zSvNu
When the field comes back false it stores the element and message into a JSON format (IE "alias" : "field is required") and passes the data back to the form. That script works well, I know because I've used it in the past with different jquery validating plugins. The plugins I used had the option of calling one remote check for all of the form elements and placing the error messages where they were needed.
jquery.validate code:
- $("#addlivestock").validate({
- rules:
- {
- species: "required",
- alias: "required",
- //parents: "required",
- gender: "required",
- birth_date: "required",
- location: "required",
- comment: "required"
- },
- messages:
- {
- species: "Choose a species!",
- alias: "Type an alias!",
- parents: "Choose a parent group!",
- gender: "Choose Male or Female!",
- birth_date: "Choose a date!",
- location: "Choose a location!",
- comment: "Type in other information about the animal."
- },
- errorPlacement:
- function(error, element)
- {
- $.each(element, function(index, value) {
- error.appendTo(element.siblings("label"));
- });
- },
- debug:true
- });
Does the jquery.validate plugin have the option to call one remote check for all the elements upon submit and place the errors where they are needed? If so, using my validate code, can someone show me an example of how that's done?
-Thank You,
Rich