For a form I'm using the following code:
class Application_Form_User_Register extends Zend_Form
{
public function init()
{
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email adres: (*)')
->setRequired(true)
->addErrorMessage('Het veld Email adres is verplicht')
->addValidator('StringLength', false,array(6,100))
->addErrorMessage('Het email adres dient uit minstens 6 karakters te bestaan')
->addValidator('EmailAddress')
->addErrorMessage('Het veld Email adres moet een geldig email adres bevatten')
->addFilter('StringTrim');
$this->addElement($email);
}
}
When i post a wrong email address from this form, it shows all 3 error messages.
For example: if I post "thisisa@nonvalidadress", it shows all errors including the error "The email adres should be at least 6 characters long".
Is there a way to change this behaviour?
Then a second question... Is there a way to show the error message above the corresponding input field? Default the error message is shown underneath.