cvs: pear /HTML_QuickForm QuickForm.php
| From: | Jason Rust | Date: | Thu, 18 Jul 2002 21:10:28 +0000 |
| Subject: | cvs: pear /HTML_QuickForm QuickForm.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5186@lists.php.net to get a copy of this message | ||
jrust Thu Jul 18 17:10:28 2002 EDT
Modified files:
/pear/HTML_QuickForm QuickForm.php
Log:
Changed the way the key is obtained for _elementIndex in addElement(). Problem arose because
removeElement() is used it messes up the key index so that count() doesn't work to get the key.
Index: pear/HTML_QuickForm/QuickForm.php
diff -u pear/HTML_QuickForm/QuickForm.php:1.30 pear/HTML_QuickForm/QuickForm.php:1.31
--- pear/HTML_QuickForm/QuickForm.php:1.30 Mon Jul 1 19:59:00 2002
+++ pear/HTML_QuickForm/QuickForm.php Thu Jul 18 17:10:28 2002
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: QuickForm.php,v 1.30 2002/07/01 23:59:00 jrust Exp $
+// $Id: QuickForm.php,v 1.31 2002/07/18 21:10:28 jrust Exp $
require_once("PEAR.php");
require_once("HTML/Common.php");
@@ -571,9 +571,11 @@
if (isset($this->_constantValues[$elementName])) {
$elementObject->onQuickFormEvent('setConstant',
$this->_constantValues[$elementName], $this);
}
- $index = count($this->_elements);
- $this->_elementIndex[$elementName] = $index;
$this->_elements[] = $elementObject;
+ end($this->_elements);
+ $index = key($this->_elements);
+ $this->_elementIndex[$elementName] = $index;
+
return $index;
} // end func addElement