Click to See Complete Forum and Search --> : get selected id from drop down list in symfony


helloise
December 10th, 2010, 04:26 AM
i have this code in a base class:


abstract class BaseLpmServiceForm extends BaseFormPropel
{
public function setup()
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'name' => new sfWidgetFormInputText(),
'wap_home' => new sfWidgetFormInputText(),
'call_center_number' => new sfWidgetFormInputText(),
'catcher_id' => new sfWidgetFormPropelChoice(array('model' => 'LpmCatcher', 'add_empty' => false)),
'price_description' => new sfWidgetFormInputText(),
'logo' => new sfWidgetFormInputText(),
'invalid_msisdn_text' => new sfWidgetFormInputText(),
'terms_and_conditions' => new sfWidgetFormInputText(),
'service_code' => new sfWidgetFormInputText(),
));

then i have this code in a form:

<tr>
<th><?php echo $form['catcher_id']->renderLabel() ?></th>
<td>
<?php echo $form['catcher_id']->renderError() ?>
<?php echo $form['catcher_id']?> //generates the drop down list
<?php
//$catcher_id = $form['catcher_id'];
//$catcher_id = $form->getObject()->getCatcherId();
$catcher_name = LpmCatcherPeer::retrieveByPK($form['catcher_id']->getValue('name'));
echo $catcher_name." ".$catcher_id;

if ($catcher_name = "zed-catcher")
{
echo $form['service_code']->renderLabel();
echo $form['service_code']->renderError();
echo $form['service_code'];

}

?>
</td>
</tr>

how can i get the selected value id??? as it is above is not working the catcher_name and catcher_id does not change if i select a different value

thanks

PeejAvery
December 11th, 2010, 03:12 AM
That's not enough relevant code to diagnose your problem. What does the outputted <select> look like?