Reputation: 234
I am using Zend\Form\View\Helper\FormSelect and I did not find the way to set selected value in select element.
$countryList = array_merge (array('empty_option' => 'Please choose...'),
$this->common()->getCountryList() );
$country->setValueOptions($countryList);
$country->setValue(array('AT' => 'AUSTRIA'));
echo $this->formSelect($country);
Upvotes: 0
Views: 1492
Reputation: 11984
$country->setValue('AT');
As above, you can use setValue() for making 'AT' as selected.
Upvotes: 1