Jump to content

echo $form['catcher_id'] dropdown list problem


helloise

Recommended Posts

the line : echo $form['catcher_id'] gives me a dropdown list

 

when i choose another item from the dropdown i want to do a few things but my code not working:

$selected_catcher = $form['catcher_id'];
foreach($selected_catcher as $val)
{ 
$catcher_name = $val->getName();
echo $catcher_name." ".$val->getId();

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

}
}

 

 

please help?

thanks

the $form['catcher_id']  which gives the dropdown list is defined in a base class as:

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(),
    ));

and gives me a list of catcher names in a dropdown list on my form.

each catcher is connected to a service....

 

if i want to attach a different catcher to the service(i choose a different catcher name from the dropdown list) and i have chosen the catcher name "zed-catcher" i want:

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

 

to display...but the lines

             $selected_catcher = $form['catcher_id'];
              foreach($selected_catcher as $val)
             {

             }

 

not working..

 

please help...hope it makes sense :)

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.