tournasdim
4/5/2014 - 7:42 PM

gistfile1.php

<?php
namespace Helloworld\Form;

use Zend\Form\Form;
use Zend\InputFilter\InputFilter;

class SignUpFilter extends InputFilter
{
	public function __construct()
	{
		$this->add(array(
			'name' => 'email',
			'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'break_chain_on_failure' => true,
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY =>
                                'Bitte geben Sie etwas ein.'
                        )
                    )
                ),
                array(
                    'name' => 'EmailAddress',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\EmailAddress::INVALID_FORMAT =>
                                'Bitte richtige E-Mail-Adresse eingeben.'
                        )
                    )
                ),
			),
		));

		$this->add(array(
			'name' => 'name',
			'filters' => array(
				array(
					'name' => 'StringTrim'
				)
			),
                        'validators' => array(
                                array(
                                       'name' => 'NotEmpty',
                                       'options' => array(
                                               'messages' => array(
                                                       \Zend\Validator\NotEmpty::IS_EMPTY =>
                                                       'Bitte geben Sie etwas ein.'
                                               )
                                       )
                                )
                        )
		));
	}
}