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

Link to comment
Share on other sites

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 :)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.