Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.6

Bug #4935 DB_Table_Quickform: Element names as Array-Keys not respected for radio buttons
Submitted: 2005-07-28 13:00 UTC
From: christian dot meixner at brandao dot de Assigned: pmjones
Status: Closed Package: DB_Table
PHP Version: 4.3.3 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [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>

Comments

 [2005-08-06 16:40 UTC] pmjones
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. Hi Christian -- I've fixed it and tested, it seems to be OK now; check out the CVS copy and see if it works the way you expect. Thanks for the report. :-)