的問題是,鑑於 因此要獲得選擇你需要
添加例如用於驗證和篩選
/**
* @Annotation\Attributes({"type":"text" })
* @Annotation\Options({"label":"Cardholder's Name: *:"})
* @Annotation\Required(false)
* @Annotation\Filters({"name":"StripTags"},{"name":"StringTrim"}})
* @Annotation\Validator({"name":"StringLength","options":{"min":"1", "max":"20"}})
*/
protected $cardholder;
/**
* @Annotation\Type("Zend\Form\Element\Select")
* @Annotation\Options({"label":"Description"})
* @Annotation\Attributes({"options":{"1":"Visa","2":"Maestro"}})
*/
protected $cardType;
,並鑑於
<dt><?php echo $this->formLabel($form->get('cardholder')); ?></dt>
<dd><?php
echo $this->formInput($form->get('cardholder'));
echo $this->formElementErrors($form->get('cardholder'));
?></dd>
<dt><?php echo $this->formLabel($form->get('cardType')); ?></dt>
<dd><?php
echo $this->formSelect($form->get('cardType'));
echo $this->formElementErrors($form->get('cardType'));
?></dd>
您是否自行搜索並試圖找到解決方案? – Stony 2012-07-16 16:38:38
我嘗試了不同的變化,但它仍然不起作用 /** * @Annotation \ Type(「Zend \ Form \ Element \ Select」) * @Annotation \ Options({「label」:「Card Type: 「}) * @Annotation \ Attributes({」options「:{」hi「:」2「,」hi2「:」2「}}) */ protected $ cardType; – 2012-07-16 17:02:15