Heterogeneous element types in AddGroup?

From: Date: Tue, 10 Jun 2003 23:00:41 +0000
Subject: Heterogeneous element types in AddGroup?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5899@lists.php.net to get a copy of this message
Hi, I'm trying to create a group in QuickForm containing a dynamic list of heterogeneous elements (text, textarea, checkbox, radio, & select). My code is at the end of this posting -- the cust_fields array gets constructed properly (3 elements indexed numerically), but when I pass it to the AddGroup, it gets transformed into the following. Am I invoking AddGroup incorrectly, or is it just not possible to construct a heterogeneous group? Thanks, Andy --- AddGroup result begin --- [custom_fields] => Array ( [name] => custom_fields [value] => [type] => group [frozen] => [label] => Custom Fields [required] => [error] => [separator] => <br /> [html] => <input name="custom_fields[field0]" type="checkbox" value="1" id="qf_90c1b2" /><label for="qf_90c1b2"></label><br /><input name="custom_fields[field1]" type="checkbox" value="1" id="qf_51c358" /><label for="qf_51c358"></label><br /><textarea name="custom_fields[field2]"></textarea> [fields] => Array ( [name] => custom_fields[field2] [value] => [type] => textarea [frozen] => [label] => We'd love to hear from you. Suggestions, feedback and ideas are all welcome. [required] => [error] => [html] => <textarea name="custom_fields[field2]"></textarea> ) ) --- AddGroup result end --- --- code begin --- while ( $row = $result_custom_fields->fetchRow( DB_FETCHMODE_ASSOC ) ) { switch($row[field_type_id]): case '1': // text break; case '2': // textbox $cust_fields[] = &HTML_QuickForm::createElement('textarea', "field$curr_field", "$row[field_intro_text]"); $curr_field++; break; case '3': // dropdown break; case '4': // radio break; case '5': // checkbox $cust_fields[] = &HTML_QuickForm::createElement('checkbox', "field$curr_field", "$row[field_intro_text]"); $curr_field++; break; endswitch; } $form->addGroup($cust_fields, 'custom_fields', 'Custom Fields','<br />'); --- code end ---

« previous php.pear.general (#5899) next »