Created
October 20, 2012 09:15
-
-
Save michael-romer/3922744 to your computer and use it in GitHub Desktop.
Listing 16.17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Helloworld\Form; | |
use Zend\Form\Fieldset; | |
class UserFieldset extends Fieldset | |
{ | |
public function __construct() | |
{ | |
parent::__construct('user'); | |
$this->add(array( | |
'name' => 'name', | |
'attributes' => array( | |
'type' => 'text', | |
'id' => 'name' | |
), | |
'options' => array( | |
'id' => 'name', | |
'label' => 'Ihr Name:', | |
) | |
)); | |
$this->add(array( | |
'name' => 'email', | |
'attributes' => array( | |
'type' => 'email', | |
), | |
'options' => array( | |
'id' => 'email', | |
'label' => 'Ihre E-Mail-Adresse:' | |
), | |
)); | |
} | |
public function getInputFilterSpecification() | |
{ | |
return array( | |
'email' => array( | |
'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.' | |
) | |
) | |
), | |
), | |
), | |
'name' => array( | |
'filters' => array( | |
array( | |
'name' => 'StringTrim' | |
) | |
), | |
'validators' => array( | |
array( | |
'name' => 'NotEmpty', | |
'options' => array( | |
'messages' => array( | |
\Zend\Validator\NotEmpty::IS_EMPTY => | |
'Bitte geben Sie etwas ein.' | |
) | |
) | |
) | |
) | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment