开发者

'Invalid' error for sfWidgetFormChoice when form is submitted

开发者 https://www.devze.com 2023-01-09 08:22 出处:网络
i want to display combo box using symfony. In the CountryForm.php i have created widget as :开发者_开发技巧

i want to display combo box using symfony. In the CountryForm.php i have created widget as :

开发者_开发技巧

$this->setWidgets(array('country' => new sfWidgetFormChoice(array('choices' => array()))));

for this validator as:

$this->setValidators(array('country' => new sfValidatorChoice(array('choices' => array(array_keys($countries))))));

I am getting error as 'Invalid' for this combobox. Any idea's on this? Thanks in advance ..


array_keys returns an array. Try:

$this->setValidators(array(
  'country' => new sfValidatorChoice(array(
      'choices' => array_keys($countries)
  ))
));
0

精彩评论

暂无评论...
验证码 换一张
取 消