Hi there! I am a newbie/n00b (or whatever you wanna call me) on ZF2. I am used to ZF1 and there are big differences, but I am not even a real programmer.
So here I go, I have a form, I tried to tell the field it has a validator or something, and I got no idea where to start if I wanna show a message that the email address ain't valid. So far I have a form working: *The controller:* public function indexAction () { $form = new LoginForm(); return array('form' => $form); } *The Form:* class Login extends Form { public function __construct () { parent::__construct('myform'); $this->setAttributes(array( 'id' => 'loginForm', 'method' => 'post' )) ->add(array( 'name' => 'username', 'attributes' => array( 'type' => 'text', ), 'filters' => array( array('StringTrim') ), 'validators' => array( array('name' => 'EmailAddress') ), 'options' => array( 'required' => true, 'label' => 'Email' ) )) ->add(array( 'name' => 'submit', 'attributes' => array( 'type' => 'submit', 'value' => 'Login' ), )); } } *The view:* echo $this->form()->openTag($form); echo $this->formRow($form->get('username')); echo $this->formSubmit($form->get('submit')); echo $this->form()->closeTag($form); -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/zf2-form-validation-tp4656907.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com