问题已经出现,因此要获得选择,您需要
添加验证和过滤示例
/**
* @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>