我現在用的小部件在Symfony的Select選項中設置默認值?
sfWidgetFormChoice(array (
'choices' => CountryPeer::getAllCountry(),
))
和驗證作爲
sfValidatorChoice(array (
'choices' => array_keys(CountryPeer::getAllCountry()),
))
我得到一個選擇元素
<select id="country" name="reg_form[country]">
<option value="1">India</option>
<option value="2">Srilanka</option>
</select>
我想補充一個選項--Select Countries--
默認:
<option value="">--Select Countries--</option>
這樣它就應該拋出一個所需的錯誤,如果我不選擇任何國家。
請將代碼格式設置爲'code sample'。 – 2009-11-19 11:50:01