Hello,
I am creating a website with Zend_Form. In my controller, I assign a form object to the view. In the view, I use the following code to render the form:
<?php if ( isset( $this->success ) ): ?>
<div class="message success"><p>Thanks!</p></div>
<?php elseif ( sizeof( $this->form->getMessages( ) ) > 0 ): ?>
<div class="message success"><p>Something went wrong..</p></div>
<?php endif; ?>
<form>
<label>Name:</label>
<?php echo $this->form->name; ?>
<label>E-mail:</label>
<?php echo $this->form->name; ?>
</form>
Until now, this way of checking if there were form errors was good enough. But my client asked me if I could also specify the field that was not correct. So, for example: "Warning: you forgot to fill in your name". I've really got no idea on how to do this with Zend. Does anybody know where to start?
Thanks,
Martijn