Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
58
rated 0 times [  65] [ 7]  / answers: 1 / hits: 22064  / 15 Years ago, mon, december 7, 2009, 12:00:00

I have this registration form which is then validated using "bassistance's" validate.js:


$('#pForm').validate({ 
rules: {
fname: "required",// simple rule, converted to {required:true}
lname: "required",
accType: "required",
country: "required",
email: {// compound rule
required: true,
email: true
},
city: "required"
},
success: function(){
$('#pForm').hide('slow');
$('#accForm').show('slow');
}
});//form validate

Now, validation is working fine, except the success tag (which I've added). So, although it says that fields are required, it goes ahead and reads the code under "success" as soon as I change one field.
Any ideas how I can get around this one? And is there an "onFailure" type of tag is jQuery?


More From » jquery

 Answers
17

Seems your success: callback is improperly defined, it must have one string argument as described in the documentation:




success String, Callback

If specified, the error label is displayed to show a valid element. If a String is given, its added as a class to the label. If a Function is given, its called with the label (as a jQuery object) as its only argument. That can be used to add a text like ok!.




Does it work when you provide a simple class-name string instead of the callback?


[#98126] Thursday, December 3, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
isaac

Total Points: 645
Total Questions: 109
Total Answers: 96

Location: Cayman Islands
Member since Fri, Mar 4, 2022
2 Years ago
;