我正在使用Zend \ Form \ View \ Helper \ FormSelect,但我没有找到在select元素中设置所选值的方法。
$countryList = array_merge (array('empty_option' => 'Please choose...'),
$this->common()->getCountryList() );
$country->setValueOptions($countryList);
$country->setValue(array('AT' => 'AUSTRIA'));
echo $this->formSelect($country);
答案 0 :(得分:1)
$country->setValue('AT');
As above, you can use setValue() for making 'AT' as selected.