PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_Table » Bug #4935

DB_Table_Quickform: Element names as Array-Keys not respected for radio buttons

Details

Submitted2005-07-28 13:00 UTC
Fromchristian dot meixner at brandao dot de
Assignedpmjones
StatusClosed
PackageDB_Table
PHP Version4.3.3
OSLinux
Roadmaps(Not assigned)

Comments

[2005-07-28 13:00 UTC] christian dot meixner at brandao dot de

Description:
------------
DB_Table Version 1.0.1

I generate a HTML-Inputform for a DB_Table instance using "$myDB_Table->getForm();"
I used the second parameter for this method, so that all Inputs will be submited within one array like: "$myDB_->getForm($cols,'fieldsArray'");". But this parameter won't be used for the generated radio buttons.

To fix this I've replaced line 210 in DB/Table/QuickForm.php with the following lines:

if (isset($arrayName) && $arrayName !='') {
$form->addGroup($element, $arrayName.'['.$cols_keys[$k].']', $cols[$cols_keys[$k]]['qf_label']);
} else {
$form->addGroup($element, $cols_keys[$k], $cols[$cols_keys[$k]]['qf_label']);
}

Test script:
---------------
/* part of DB Schema definition array */
var $col = array('radioExample' => array(
'type' => 'integer',
'qf_type' => 'radio',
'qf_vals' => array(1 => 'one',
2 => 'two')
),
)

$showCols = array(
'radioExample' => '',
);

$myDB_->getForm($showCols ,'fieldsArray'");

Expected result:
----------------
<!-- expected HTML-Source of the radiobutton ->
<input value="1" id="qf_398657" name="fieldsArray[radioExample]" type="radio"><label for="qf_398657">one<br></label>

Actual result:
--------------
<!-- expected HTML-Source of the radiobutton ->
<input value="1" id="qf_398657" name="radioExample" type="radio"><label for="qf_398657">one<br></label>