Hello ive hackeds away and got a solution to get it to work : $(document).ready(function() {
jQuery.validator.setDefaults({ errorPlacement: function(error, element) { error.appendTo( element.siblings('span.valmessage') )//, } }); var validator = $("#loginform").validate({ rules: { f_email0: {required: true, email: true}, f_password0: {required: true, minlength: 6} }, messages: { f_email0: { required: "Enter your email address", email: "Enter a valid email address" //remote: jQuery.format("{0} is already in use") }, f_password0: { required: "Provide a password", rangelength: jQuery.format("Enter at least {0} characters") } }, showErrors: function(errorMap, errorList) { var errors = this.numberOfInvalids(); if (errors) { var message = errors == 1 ? 'You missed <b><u>1</u></b> field below. It has been highlighted' : 'You missed <b><u>' + errors + '</u></b> fields below. They have been highlighted'; $("div#formerror1 span").html(message); $("div#formerror1").slideDown(); } else { $("div#formerror1").slideUp(); } this.defaultShowErrors(); } }); }); ASD the showErrors updates the error count on every event i put an errorPlacement rule as a default and called this from the ShowErrors option, this works well i think its not a hack but seams to be correct way of doing this, if you know of a better way please let me know. Thanks On Jan 8, 7:04 pm, morraine <i...@morraine.co.uk> wrote: > Hi jörn thanks for the reply; > > OK yes i have seen than demo and ive played about with it as well but > it seems to only update the amount when you click the submit button. I > want it to update on every validation event (keyup, focus etc....) so > that when you enter the correct information for 5 incorrect fields it > will update as you go with each field validation. and then if all the > fields have been entered correctly then it will hide all with out > hitting the submit button again. then the user can hit the submit > button. > > How can i do this? > > Thanks again for you help. > > On Jan 8, 6:43 pm, "Jörn Zaefferer" <joern.zaeffe...@googlemail.com> > wrote: > > > > > Take a look at this demo:http://jquery.bassistance.de/validate/demo/marketo/ > > The interesting part is here: > > > $("form").bind("invalid-form.validate", function(e, validator) { > > var errors = validator.numberOfInvalids(); > > if (errors) { > > var message = errors == 1 > > ? 'You missed 1 field. It has been > > highlighted below' > > : 'You missed ' + errors + ' fields. They > > have been highlighted below'; > > $("div.error span").html(message); > > $("div.error").show(); > > } else { > > $("div.error").hide(); > > } > > }).validate({ ... }); > > > Jörn > > > On Thu, Jan 8, 2009 at 6:41 PM, morraine <i...@morraine.co.uk> wrote: > > > > hello i got a nice form system going with some custom placement of > > > errors but i want to also count the amoutn of errors and display that > > > as well. How can i do this in code? > > > > i have this : > > > > errorPlacement: function(error, element) { > > > > error.appendTo( element.siblings('span.valmessage') ) > > > > } > > > > which displays the errors were i want them but when i try to use this > > > as well to have a live view of the amount of errors: > > > > showErrors: function(errorMap, errorList) { > > > $("div#formerror span").html("Your form contains " > > > + this.numberOfInvalids() > > > + " errors, see details below."); > > > } > > > > errorPlacement wont work with it?!?!? > > > > how can i merge the two functions together into showErrors option so > > > as to place my errors where i want and also display the amount of > > > errors at the same time > > > > thanks for help im new to jquery and im not sure how the show error > > > option works in regards to the errorMap and errorList arguments that > > > come into it.- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -