开发者

'Invalid' error for sfWidgetFormChoice when form is submitted

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜