jQuery validate plugin - showErrors option - errorContainer not un-hiding / showing -


i've been trying nice validation solution work site, i'm having trouble different options. have read docs thoroughly , looked @ examples, i'm still having issues.

my form in table. want each row have it's own error row beneath it, ordinarily hidden, show each row appropriate.

the following options hid , showed error rows fine, error message shown in each error row whole concatenation of every error message:

$('#myform').validate({     rules: {         firstname: "required",         lastname: "required"     },     messages: {         firstname: "enter first name.",         lastname: "enter last name."     },     errorcontainer: '.errorrow',     errorlabelcontainer: '.errorrow.appvaluecolumn',     errorplacement: function(error, element) {         error.appendto( element.parent().next() );     } }); 

so tried use showerrors option follows:

  $('#myform').validate({         rules: {             firstname: "required",             lastname: "required"         },         messages: {             firstname: "enter first name.",             lastname: "enter last name."         },         errorcontainer: '.errorrow',         errorcontainer: '.errorrow.appvaluecolumn',         showerrors: function(errormap, errorlist) {         $.each(errormap, function(key, value) {        $('#'+key).parent().next().children('.appvaluecolumn').html(errormap[key]); }); 

well, errors separated , shown in correct place, can't .errorrows show. doing wrong here?

many thanks

if @ source of validation plugin showerrors method, have:

this.settings.showerrors             ? this.settings.showerrors.call( this, this.errormap, this.errorlist )             : this.defaultshowerrors(); 

this means if provide custom handler method, default behavior not executed.

you either call this.defaultshowerrors() @ end of own showerrors handler, become:

showerrors: function(errormap, errorlist) {     $.each(errormap, function(key, value) {         $('#'+key).parent().next().children('.appvaluecolumn')                   .html(errormap[key]);     });     this.defaultshowerrors(); }); 

hope helps !


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -