又一头雾水。(Zend 框架 1.11.1)
我刚刚在一个非常简单的表单中添加了一个验证器,当输入无效数据时没有任何反应。
编码:
$form = new Zend_Form;
$form->setAction('/MyController/reponsepage')
->setMethod('post');
$form->setAttrib('id', 'firstTestForm');
$form->addElement('text', 'email', array('label' => 'EMail', 'value' => $this->_user['email']));
$form->addElement('hidden', 'expertID', array('value' => $_targetExpertID));
$form->addElement('submit', 'Submit and Be Free!');
$v = new Zend_Validate_EmailAddress();
$v->setMessage('Please enter a valid email address.');
$mailElem = $form->getElement('email')
->addValidator($v)
->setRequired(true);
$this->view->form = $form;
setRequired 似乎什么也没做。将该字段留空并点击提交即可。垃圾数据也会直接通过。
没有错误信息,什么都没有。
库目录包含:
PATH_BLAH\library\Zend\Validate.php and
PATH_BLAH\library\Zend\Validate\ with all the normal stuff
很难猜出什么可能是错的。
如果您想到任何线索,我将不胜感激。
谢谢阅读。