QFC and numeric indexes as element names in groups?

From: Date: Mon, 01 Mar 2004 14:30:47 +0000
Subject: QFC and numeric indexes as element names in groups?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11029@lists.php.net to get a copy of this message
QFC does not seem to handle numeric indexes as I would expect in the following example: <?php require_once "HTML/QuickForm/Controller.php" ; require_once "HTML/QuickForm/Action.php" ; class Page1 extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $select = array( 1 => "me", 2 => "you" ) ; $data = array( 12 => 12000, 11 => 11000 ) ; foreach ( $data as $key => $value ) { // Add a SELECT element $group[] =& $this->createElement( "select", $key, $value, $select ) ; } $this->addGroup( $group, "people", NULL, "<br/>" ) ; // QFC action element $this->addElement( 'submit', $this->getButtonName( 'next' ), 'Submit changes' ) ; } } class ActionProcess extends HTML_QuickForm_Action { function perform( &$page, $actionName ) { print_r( $GLOBALS['container'] ) ; die ; } } $wizard =& new HTML_QuickForm_Controller( '' ) ; $container =& $wizard->container() ; $wizard->addPage( new Page1( 'page1' ) ) ; $wizard->addAction( 'process', new ActionProcess() ) ; $wizard->run() ; ?> The indexes on group elements in the container are not 12 and 11 as I would expect, but 12 and 13. Does it mean one should abstain from using numeric values as indexes for group element names? That would be a pity! Thanks

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