errorsFor method does not support complex names
August 6, 2009 - 5:38pm — jon.barksdale
| Project: | Validation |
| Version: | 1.5.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
If one adds validation to a form with a complex name, such as 'something.else[0]', every time validation fails, a new error message appears, and the old ones remain. I have traced the problem to the errorsFor method, with the filter on the for attribute.
Original (breaks):
errorsFor: function(element) {
return this.errors().filter("[for='" + this.idOrName(element) + "']");
},Patched version (works for both cases):
errorsFor: function(element) {
var name = this.idOrName(element);
return this.errors().filter(function() { return $(this).attr('for') == name; });
},
Comments
#1
Thanks, applied the patch. Will be included in the upcoming 1.6 release.
#2
Automatically closed -- issue fixed for two weeks with no activity.
#3
I agree with the statement that China and the United States can together drive a global clean energy economy that may define the 21st century! Cool facts for writing a paper in college or university for scientific classes! Online Business management degree AND Online Occupational safety and health degree AND Psychology degree AND Network degree AND online phd degrees