helloise Posted January 10, 2011 Share Posted January 10, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/223938-echo-formcatcher_id-dropdown-list-problem/ Share on other sites More sharing options...
Adam Posted January 10, 2011 Share Posted January 10, 2011 Can you provide a var_dump() of $form['catcher_id'] so that we know what you're working with? Could you also explain what you want to do and what's not working? Quote Link to comment https://forums.phpfreaks.com/topic/223938-echo-formcatcher_id-dropdown-list-problem/#findComment-1157291 Share on other sites More sharing options...
helloise Posted January 10, 2011 Author Share Posted January 10, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/223938-echo-formcatcher_id-dropdown-list-problem/#findComment-1157294 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.