本文整理汇总了PHP中Zend_Form::hasErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::hasErrors方法的具体用法?PHP Zend_Form::hasErrors怎么用?PHP Zend_Form::hasErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::hasErrors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasErrors
public function hasErrors()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
if ($this->_formID == $request->getParam('form_name') || $this->_formID === null) {
return parent::hasErrors();
}
}
示例2: testShouldAllowPushingErrorsOntoErrorStackWithErrorMessages
public function testShouldAllowPushingErrorsOntoErrorStackWithErrorMessages()
{
$this->assertFalse($this->form->hasErrors());
$this->form->setErrors(array('Error 1', 'Error 2'))->addError('Error 3')->addErrors(array('Error 4', 'Error 5'));
$this->assertTrue($this->form->hasErrors());
$messages = $this->form->getMessages();
$this->assertEquals(5, count($messages));
foreach (range(1, 5) as $id) {
$message = 'Error ' . $id;
$this->assertContains($message, $messages);
}
}
示例3: testHasErrorsMethodShouldCheckAlsoSubForms
/**
* @group GH-319
*/
public function testHasErrorsMethodShouldCheckAlsoSubForms()
{
// Init form
$form = new Zend_Form();
$subForm = new Zend_Form_SubForm();
$element = new Zend_Form_Element_Text('foo');
$subForm->addElement($element);
$form->addSubForm($subForm, 'subForm');
$element->markAsError();
// Test form
$this->assertTrue($form->hasErrors());
$this->assertFalse($form->isValid(array('foo' => 1)));
// Test element
$this->assertTrue($element->hasErrors());
$this->assertFalse($element->isValid(1));
}