Skip to main content

Bug Tracker

Side navigation

#3569 closed bug (wontfix)

Opened November 03, 2008 05:19PM UTC

Closed June 10, 2009 10:15AM UTC

[validate] Validation error is not removed if placeholder is not within the validated <form>

Reported by: noahsatellite Owned by: joern
Priority: minor Milestone: 1.3
Component: plugin Version: 1.2.6
Keywords: validate Cc: noah.blumenthal@gmail.com
Blocked by: Blocking:
Description

If the errorPlacement hook is used to add errors to DOM elements outside the form being validated, the error is added when invalid but never removed when valid. Multiple of the same error can be visible at once because the error is never removed before re-validation begins.

take for example this simple form:

<ul id="clientvalidation"></ul>

<form id="myForm">

Name: <input type="textbox" id="Name" />

<input type="submit" value="submit" />

</form>

with this validation:

$("#myForm").validate({

errorElement: "li",

errorPlacement: function(error, element){

error.appendTo($("#clientvalidation"));

},

rules: {

Name: {required: true}

}

messages: {

Name: {required: "Name is required"}

}

});

If you press the submit button multiple times you'll see the error message appear multiple times.

Attachments (0)
Change History (2)

Changed November 06, 2008 09:51PM UTC by flesler comment:1

owner: → joern

Changed June 10, 2009 10:15AM UTC by joern comment:2

resolution: → wontfix
status: newclosed

Is there an actual reason to place that element outside the form? The form element itself isn't a visual element at all, so making the form a parent element of that ul shouldn't be a problem at all.