Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery validate plugin - showErrors option - errorContainer not un-hiding / showing
    primarykey
    data
    text
    <p>I've been trying to get a nice validation solution to work for my site, but I'm having trouble with the different options. I have read the docs thoroughly and looked at examples, but I'm still having issues.</p> <p>My form is in a table. I want each row to have it's own error row beneath it, which would ordinarily be hidden, but which would show for each row as appropriate.</p> <p>The following options hid and showed the error rows fine, but the error message shown in each error row was the whole concatenation of every error message:</p> <pre><code>$('#myform').validate({ rules: { firstName: "required", lastName: "required" }, messages: { firstName: "Enter your first name.", lastName: "Enter your last name." }, errorContainer: '.errorRow', errorLabelContainer: '.errorRow.appValueColumn', errorPlacement: function(error, element) { error.appendTo( element.parent().next() ); } }); </code></pre> <p>so I tried to use the showErrors option as follows:</p> <pre><code> $('#myform').validate({ rules: { firstName: "required", lastName: "required" }, messages: { firstName: "Enter your first name.", lastName: "Enter your last name." }, errorContainer: '.errorRow', errorContainer: '.errorRow.appValueColumn', showErrors: function(errorMap, errorList) { $.each(errorMap, function(key, value) { $('#'+key).parent().next().children('.appValueColumn').html(errorMap[key]); }); </code></pre> <p>Well, now the errors are all separated and shown in the correct place, but I can't get the <code>.errorRows</code> to show. What am I doing wrong here?</p> <p>Many thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload