QuickForm error object, messages
| From: | Mark Steudel | Date: | Thu, 15 Jun 2006 18:26:43 +0000 |
| Subject: | QuickForm error object, messages | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-24388@lists.php.net to get a copy of this message | ||
I would like to display a summary of errors at the top of my form and was
wondering if there was some way to know if errors are set and a way to
access the errors, something kinda like:
$form = new HTML_QuickForm('formname');
if( $form->errorOjbect )
{
Foreach( $form->errorMessages as $message )
{
// format errors
$errors = "<li>".$message."</li>";
// assign to template
$tpl->assign( 'error', $errors );
}
}
Form elements ...
If( $form->validate() )
{
Process form
}
Else
{
$form->display();
}
Thanks, Mark