CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2010
    Posts
    1

    get selected id from drop down list in symfony

    i have this code in a base class:


    PHP Code:
    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:

    PHP Code:
    <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
    Last edited by PeejAvery; December 11th, 2010 at 03:20 AM. Reason: Added PHP tags

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: get selected id from drop down list in symfony

    That's not enough relevant code to diagnose your problem. What does the outputted <select> look like?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured