Hi there, I have a form which validates my inputs, it works... but it looks weird.... Lets give a simple example:
-------------------------- namespace Contact\Form; use Zend\Form\Form, Zend\InputFilter\InputFilter, Zend\InputFilter\Input, Zend\Validator\ValidatorChain, Pixiebox\Api; class Contact extends Form { public function mail () { $form = new Form('contactFrm'); $form->setAttributes(array( 'class' => 'span8 validate', 'method' => 'post', ))->add(array( 'name' => 'voornaam', 'attributes' => array( 'data-valid' => 'notempty', 'maxlength' => 80, 'required' => 'required', 'size' => 40, 'type' => 'text', )); $inputFilter = new InputFilter(); // Create a input $inputFirstname = new Input('voornaam'); $validatorFirstname = new ValidatorChain(); $validatorFirstname->addValidator(new \Zend\Validator\StringLength(array('min' => 2, 'max' => 80))); $inputFirstname->setValidatorChain($validatorFirstname); $form->setInputFilter($inputFilter); return $form; } } --------------------- In the Controller I do this: ---------------------- $contactForm = new \Contact\Form\Contact(); $form = $contactForm->contact(); $request = $this->getRequest(); if ($request->isPost()) { $post = $request->getPost(); $form->setData($post); if ($form->isValid()) { // do some magic } } ---------------- -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/form-input-validators-it-works-but-am-I-doing-it-right-tp4659030.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