Ticket #3569 (closed bug: wontfix)
[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@… |
| Blocking: | Blocked by: |
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.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
