PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Get error status

Did your form have failed validations on submission? In most cases, you can simply render the form again, and errors will be displayed when using the default decorators:

<?php
if (!$form->isValid($_POST)) {
    echo 
$form;

    
// or assign to the view object and render a view...
    
$this->view->form $form;
    return 
$this->render('form');
}

If you want to inspect the errors, you have two methods. getErrors() returns an associative array of element names / codes (where codes is an array of error codes). getMessages() returns an associative array of element names / messages (where messages is an associative array of error code / error message pairs). If a given element does not have any errors, it will not be included in the array.

Zend Framework