不确定这是否是最佳方式,但它对我有用:
$questionValid = new Zend_Validate_InArray(array('Yes')); $questionValid->setMessage('Yes is required!'); $question = new Zend_Form_Element_Radio('question'); $question->setRequired(true) ->setLabel('Are you sure?') ->setMultiOptions(array('Yes'=>'Yes', 'No'=>'No')) ->addValidator($questionValid);