2017-06-20 98 views
1

如何從提交表單的表單選擇小部件中獲取價值?從表單選擇中獲取價值Symfony 1.4

現在它只返回所選選項的整數索引,但我需要一個值。

下面是我的代碼:

$this->setWidget('emails',new sfWidgetFormChoice([ 
     'label' => __('Emails'), 
     'expanded' => true, 
     'multiple' => true, 
     'choices' => ['[email protected]', '[email protected]'], 
    ])); 

$this->setValidators([ 
     'emails' => new sfValidatorChoice(
      ['choices' => array_keys($this->getDefault('emails')), 'multiple' => true], 
      ['required' => __('Required')]), 

回答