cvs: pear /DB_Table/DB/Table QuickForm.php
| From: | Paul Jones | Date: | Sat, 28 May 2005 13:34:47 +0000 |
| Subject: | cvs: pear /DB_Table/DB/Table QuickForm.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32174@lists.php.net to get a copy of this message | ||
pmjones Sat May 28 09:34:47 2005 EDT
Modified files:
/pear/DB_Table/DB/Table QuickForm.php
Log:
Fixed bug 3892 "Error in DB_Table_QuickForm->addElements" when adding radio elements.
Applied patch noted by Mark Wiesemann relating to addElements(), but instead of
applying second fix relating to fixColDef, I just cast the qf_vals to an array
at foreach() time.
http://cvs.php.net/diff.php/pear/DB_Table/DB/Table/QuickForm.php?r1=1.20&r2=1.21&ty=u
Index: pear/DB_Table/DB/Table/QuickForm.php
diff -u pear/DB_Table/DB/Table/QuickForm.php:1.20 pear/DB_Table/DB/Table/QuickForm.php:1.21
--- pear/DB_Table/DB/Table/QuickForm.php:1.20 Tue May 24 10:49:37 2005
+++ pear/DB_Table/DB/Table/QuickForm.php Sat May 28 09:34:47 2005
@@ -11,7 +11,7 @@
*
* @license http://www.gnu.org/copyleft/lesser.html LGPL
*
-* @version $Id: QuickForm.php,v 1.20 2005/05/24 14:49:37 pmjones Exp $
+* @version $Id: QuickForm.php,v 1.21 2005/05/28 13:34:47 pmjones Exp $
*
*/
@@ -202,11 +202,13 @@
function addElements(&$form, $cols, $arrayName = null)
{
$elements =& DB_Table_QuickForm::getElements($cols, $arrayName);
+ $cols_keys = array_keys($cols);
foreach (array_keys($elements) as $k) {
$element =& $elements[$k];
if (is_array($element)) {
- $form->addGroup($element, $element->getName(), $col['qf_label']);
- } else if (is_object($element)) {
+ //$form->addGroup($element, $element->getName(), $col['qf_label']);
+ $form->addGroup($element, $cols_keys[$k],
$cols[$cols_keys[$k]]['qf_label']);
+ } elseif (is_object($element)) {
$form->addElement($element);
}
}
@@ -400,7 +402,7 @@
$element = array();
- foreach ($col['qf_vals'] as $btnvalue => $btnlabel) {
+ foreach ((array) $col['qf_vals'] as $btnvalue => $btnlabel) {
if (isset($setval) && $setval == $btnvalue) {
$col['qf_attrs']['checked'] = 'checked';