FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=19063&edit=1

ID: 19063
Comment by: loki_angel@mail.ru
Reported By: loki_angel at mail dot ru
Summary: error in JS _clearErrors()
Status: Open
Type: Bug
Package: HTML_QuickForm2
Operating System: irrelevant
Package Version: 0.6.1
PHP Version: irrelevant
Roadmap Versions:
New Comment:

possible solution:
function _clearErrors(element)
{
var spans = element.getElementsByTagName('span');
for (var i = 0, span; span = spans[i]; i++) {
if (qf.classes.has(span, 'error')) {
qf.classes.remove(span.parentNode, ['error', 'valid']);
span.parentNode.removeChild(span);
i--;
}
}
};


Previous Comments:
------------------------------------------------------------------------

[2011-11-21 14:02:51] loki

-Operating System:
+Operating System: irrelevant
-PHP Version: 5.2.9
+PHP Version: irrelevant


------------------------------------------------------------------------

[2011-11-21 12:02:37] loki

Description:
------------
function _clearErrors(element)
{
var spans = element.getElementsByTagName('span');
for (var i = 0, span; span = spans[i]; i++) {
if (qf.classes.has(span, 'error')) {
span.parentNode.removeChild(span);
}
}
};

function has followed errors:

1. after remove "span" from "spans", "spans" becomes one element less.
So indexes sifts. Iterator "i" still rise and some spans are skips.

2. function does not remove the "error" class of the parent element.
It's problem for chained rules.

------------------------------------------------------------------------

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouppear-bugs @
categoriesphp
postedNov 21, '11 at 1:03p
activeNov 22, '11 at 4:46p
posts3
users3
websitepear.php.net

People

Translate

site design / logo © 2022 Grokbase