Still no go... below is my code. I just want to pop a dialog to ask the user if they are sure they want to leave the company name blank. The field is not required. I thought it would be easier than this? I can't get teh addMethod to work or fire at all on validation.
//validates the form var validator = frmSubmittal.validate({ debug: false, focusCleanup: false, focusInvalid: false, onfocusout: false, onkeyup: false, errorPlacement: function(error, element) {error.prependTo ( element.parents("div.ctrlHolder"));}, errorElement:'div', errorClass:'valerror', rules: { restitutionaddress: {required: "#sameAsBusinessAddress [checked='false']"}, restitutioncity: {required: "#sameAsBusinessAddress [checked='false']"}, restitutionstate: {required: "#sameAsBusinessAddress [checked='false']"}, restitutionzipcode: {required: "#sameAsBusinessAddress [checked='false']"}, company:true } }); $.validator.addMethod( "company", function(value, element) {alert ("hello"); return false;}, "Enter a Company Name" ); On Oct 21, 9:18 pm, Leonardo K <leo...@gmail.com> wrote: > U need set the rules for your validation: > > frmSubmittal.validate({ > debug: false, > focusCleanup: false, > focusInvalid: false, > onfocusout: false, > onkeyup: false, > errorPlacement: function(error, element) { > error.prependTo( element.parents("div.ctrlHolder")); > }, > errorElement:'div', > errorClass:'valerror', > rules:{ > nameField:{ > company:true > } > } > > }); > On Wed, Oct 21, 2009 at 22:04, JMan <jbeck...@gmail.com> wrote: > > > what am I doing wrong here? I cannot figure out how to use the > > addMethod(). > > > var frmSubmittal = $("#frmSubmittal"); > > > //validates the form > > frmSubmittal.validate({ > > debug: false, > > focusCleanup: false, > > focusInvalid: false, > > onfocusout: false, > > onkeyup: false, > > errorPlacement: > > function(error, element) {error.prependTo > > ( element.parents("div.ctrlHolder"));}, > > errorElement:'div', > > > errorClass:'valerror' > > > }); > > > $.validator.addMethod( "company", function(value, element) {alert > > ("hello"); return false;}, "Enter a Company Name" );