QuickForm problems setting defaults
| From: | Mark Steudel | Date: | Wed, 13 Apr 2005 22:38:48 +0000 |
| Subject: | QuickForm problems setting defaults | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-18742@lists.php.net to get a copy of this message | ||
I was hoping someone would take a look and see what I'm doing wrong when
setting the defaults values for a form:
$form = new HTML_QuickForm('addproducts');
$form->addElement('header', null, 'Edit Products');
$form->addElement('select', "upc$i", 'UPC:', $selectArray, array (
'id' =>
"upc$i", 'onChange' => "addText(upc$i);"));
$form->addElement('text', "distpart$i", 'Distributor Part:',
array('size' =>
40, 'maxlength' => 255 ));
$form->addElement('text', "quantity$i", 'Quantity:',
array('size' => 40,
'maxlength' => 255 ));
$form->setDefaults ( array('upc$i' => $objData->upc, 'distpart$i' =>
$objData->distpart, 'quantity$i'=>$objData->quantity));
$objData is the the results of a mysql_fetch_object(). I've tested that the
data is getting into to $objData by doing a print_r( $objData ); right
before I create the form, sample results:
stdClass Object ( [id] => 2 [orderid] => 1 [upc] => 852362000125 [pwipart]
=> 0 [distpart] => 0 [quantity] => 0 [description] => )
Thanks in advance, Mark