2017-06-20 108 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')]), 

回答