I'm using the Jquery validate function for my form validation. So far I've been appending the error to a page element, but I now want to display it in an alert popup.
The alert popup successfully displays the error message when the user has not selected anything, however when they submit a valid form, the pop still appears this time without the error message.
How do I stop the popup from appearing after a valid form submission?
Here is my js code, I've implemented the alert for radio buttons. You can see this in action on
http://hiplogger.hip-zone.co.za/partner/mobile $("#quickieform").validate({
rules: {
answer: "required"
},
answer: {
answer: "Please make a selection"
},
errorPlacement: function(error, element) {
if ( element.is(":radio") )
alert(error.html()); else if ( element.is(":checkbox") )
error.appendTo( ("#alertbox") );
else
error.appendTo( ("#alertbox") );
},
submitHandler: function(form) {
// do other stuff for a valid form
form.submit();
},
success: function(label) {
// set as text for IE
label.html(" ").addClass("checked");
}
});