when i run "this.submit();" i submit my ajax request, so how can i get the validate to fire on invalidHandler and submitHandler so I will only run this.submit(); when it passes validation ? Currently the validator does not validate the form at all on submit, I need it to cancel the submit if there are validation issues and submit if there are none.
function submitForm(form) { this.submit(); $("#frmAddTask").validate({ errorPlacement: function(error, element) { error.insertAfter (element); }, invalidHandler: function(form, validator) { alert("validation failed"); }, submitHandler: function(form, validator) { alert("validation passed"); }, rules: { title: { required: true, minlength: 5 } } }); } // Build Add a New Task pop up dialog // Instantiate the Add a New Task pop up dialog YAHOO.util.Dom.removeClass('dlgAddTask', 'hideForm'); YAHOO.techdocs.dlgAddTask = new YAHOO.widget.Dialog("dlgAddTask", { width : "50em", height: "32em", fixedcenter : true, visible : false, constraintoviewport : true, close: false, buttons : [ { text:"Submit", handler:submitForm, isDefault:true }, { text:"Cancel", handler:function() {this.cancel();} } ] });