Skip to content

Instantly share code, notes, and snippets.

@alexshelkov
Created October 29, 2012 17:42
Show Gist options
  • Save alexshelkov/3975120 to your computer and use it in GitHub Desktop.
Save alexshelkov/3975120 to your computer and use it in GitHub Desktop.
<?php
namespace Application\Form;
use Zend\Form\Form;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
use Zend\InputFilter\InputFilterProviderInterface;
class UserRegister extends Form implements InputFilterProviderInterface
{
public function __construct($name = null, $options = array())
{
parent::__construct('user_register', $options);
$this->setAttribute('method', 'post');
$this->setHydrator(new ClassMethodsHydrator(false));
// I create and add fieldset Application\Form\Fieldset\User
$this->add(array(
'type' => 'Application\Form\Fieldset\User',
'options' => array(
'use_as_base_fieldset' => true
)
));
$this->add(array(
'name' => 'submit',
'attributes' => array(
'type' => 'submit',
'value' => 'Register',
)
));
}
public function getInputFilterSpecification()
{
return array(
// here I want some filter and validator for my user.name
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment