views:

42

answers:

1

Hi, 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 ..

+1  A: 

array_keys returns an array. Try:

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