i want to multidimensional array to my view and then use this array to build form
This is what i've in my controller
function signin(){
$attributes = array(
'name' =>
array(
'name' => 'name',
'type' => 'text',
'placeholder' => '' ,
'value' => 'value'
),
'password' =>
array(
'name' => 'name',
'type' => 'password',
'placeholder' => '',
),
'gender' =>
array(
'name' => 'name',
'type' => 'select',
'value'=>
array(
'male','female'
),
),
'usertpye'=>array(
'type' => 'radio',
'seller' => 'seller',
'buyer' => 'buyer'
),
'upload'=>array(
'type' => 'file',
'name' => 'file'
),
'submit'=>array(
'type' => 'submit',
'name' => 'submit',
'value' => 'submit'
)
);
$this->load->view('login',$attributes);
}
in my view login i can access these items like $name or $password but i want to fetch in a loop.really have no idea how can i do it please help.
The load function receives an array, which keys then parses as variables in the view. Thus, you get variables like $name, $password etc.
Just add another layer before calling the load function like:
$data['attributes'] = $attributes;
And then, when loading the view do
$this->load->view('login',$data);
Here is the array a bit adjusted:
$attributes = array(
'name' =>
array(
'name' => 'name',
'type' => 'text',
'placeholder' => '' ,
'value' => 'value'
),
'password' =>
array(
'name' => 'name',
'type' => 'password',
'placeholder' => '',
),
'gender' =>
array(
'name' => 'name',
'type' => 'select',
'options' => array(
'male' => 'Male',
'female' => 'Female'
),
),
'usertpye'=>array(
'type' => 'radio',
'values' => array(
'seller' => 'seller',
'buyer' => 'buyer'
)
),
'upload'=>array(
'type' => 'file',
'name' => 'file'
),
'submit'=>array(
'type' => 'submit',
'name' => 'submit',
'value' => 'submit'
)
);
Here is how it would look like with the form helper of CI (this would go in the view, remember to first load the helper in the controller):
echo form_open('email/send');
foreach($attributes as $key=>$attribute) {
echo form_label($key).'<br/>';
if($attribute['type'] == 'select') {
echo form_dropdown($attribute['name'],$attribute['options']).'<br/>';
} elseif($attribute['type'] == 'radio') {
foreach ($attribute['values'] as $value) {
echo form_label($value);
echo form_radio(array('name' => $key, 'value' => $value)).'<br/>';
}
} else {
echo form_input($attribute).'<br/>';
}
}
Note I did some adjustments to your initial attributes array to make it work, but you'd still need to improve its structure, add unique names for all items etc.
Related
I'm trying to create a form that contains a collection of fieldsets using only array specs and Zend\Form\Factory.
Here is how I create the form using the factory:
$factory = new Zend\Form\Factory();
$fieldset = $factory->createFieldset(array(
'elements' => array(
array(
'spec' => array(
'name' => 'name',
'type' => 'Text',
'attributes' => array(
'class' => 'form-control input-sm',
),
'options' => array(
'label' => 'Name',
),
),
),
array(
'spec' => array(
'name' => 'driverClass',
'type' => 'Text',
'attributes' => array(
'class' => 'form-control input-sm',
),
'options' => array(
'label' => 'Driver',
),
),
),
),
'input_filter' => array(
'name' => array(
'required' => true,
),
),
));
$form = $factory->createForm(array(
'name' => 'application-form',
'attributes' => array(
'role' => 'form',
),
'elements' => array(
array(
'spec' => array(
'type' => 'Collection',
'name' => 'connection',
'options' => array(
'label' => 'Connections',
'allow_add' => true,
'allow_remove' => true,
'should_create_template' => true,
'count' => 2,
'target_element' => $fieldset,
),
),
),
array(
'spec' => array(
'name' => 'security',
'type' => 'Csrf',
'attributes' => array(
'required' => 'required',
),
),
),
array(
'spec' => array(
'name' => 'submit',
'type' => 'Submit',
'attributes' => array(
'class' => 'btn btn-sm btn-primary',
),
'options' => array(
'label' => 'Apply',
),
),
),
),
));
The resulting form works fine when I try to set data and render form elements. But when I validate it and retrieve data, like so (in a controller):
$form->setData($this->getRequest()->getPost());
if ($form->isValid() === true) {
$data = $form->getData();
var_dump($this->getRequest()->getPost());
var_dump($data);
}
With this set of data as POST:
object(Zend\Stdlib\Parameters)[141]
private 'storage' (ArrayObject) =>
array (size=3)
'connection' =>
array (size=2)
0 =>
array (size=2)
'name' => string 'orm_default' (length=11)
'driverClass' => string 'Doctrine\DBAL\Driver\PDOMySql\Driver' (length=36)
1 =>
array (size=2)
'name' => string 'blog' (length=4)
'driverClass' => string 'Doctrine\DBAL\Driver\PDOMySql\Driver' (length=36)
'submit' => string '' (length=0)
'security' => string '20d5c146d8874dc804948e962d5de91b-87c9e4097f9140d259efb5c589a05d6b' (length=65)
The array returned by the call to $form->getData() shows an empty collection:
array (size=3)
'security' => string '20d5c146d8874dc804948e962d5de91b-87c9e4097f9140d259efb5c589a05d6b' (length=65)
'submit' => string '' (length=0)
'connection' =>
array (size=0)
empty
What am I missing?
The expected result is a collection, named 'connection' in this example, containing two arrays representing the two fieldsets as specified by the POST data. I have a feeling this has to do with a missing InputFilter (or at least its specs) because I have managed to obtain the expected result when I implement a fieldset class that extends Zend\Form\Fieldset and implements Zend\InputFilter\InputFilterProviderInterface.
Just discovered this class Zend\Form\InputFilterProviderFieldset which does exactly what I missed.
I added a type in the fieldset specs and changed the input filter specs (which is mandatory) like so:
$fieldset = $factory->createFieldset(array(
'type' => 'Zend\Form\InputFilterProviderFieldset',
'elements' => array(
array(
'spec' => array(
'name' => 'name',
'type' => 'Text',
'attributes' => array(
'class' => 'form-control input-sm',
),
'options' => array(
'label' => 'Name',
),
),
),
array(
'spec' => array(
'name' => 'driverClass',
'type' => 'Text',
'attributes' => array(
'class' => 'form-control input-sm',
),
'options' => array(
'label' => 'Driver',
),
),
),
),
'options' => array(
'input_filter_spec' => array(
'name' => array(
'required' => true,
),
),
),
));
And it works fine now. Hope this helped someone.
I have the following element in my form, and I tried all possible options found in the web to allow empty value for element:
$this->add(array(
'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox',
'name' => 'directPractice',
'options' => array(
'label' => 'A. Check all direct practice field education assignments',
'label_attributes' => array(
'class' => 'label-multicheckbox-group'
),
'required' => false,
'allow_empty' => true,
'continue_if_empty' => false,
'object_manager' => $this->getObjectManager(),
'target_class' => 'OnlineFieldEvaluation\Entity\FieldEducationAssignments', //'YOUR ENTITY NAMESPACE'
'property' => 'directPractice', //'your db collumn name'
'disable_inarray_validator' => true,
'value_options' => array(
'1' => 'Adults',
'2' => 'Individuals',
'3' => 'Information and Referral',
'4' => 'Families',
array(
'value' => 'Other',
'label' => 'Other (specify)',
'label_attributes' => array(
'class' => 'bindto',
'data-bindit_id' => 'otherDirectPracticeTxt_ID'
),
'attributes' => array(
'id' => 'otherDirectPractice_ID',
),
)
),
),
'attributes' => array(
'value' => '1', //set checked to '1'
'multiple' => true,
)
));
And I am always getting the same error message when it is empty:
Validation failure 'directPractice':Array
(
[isEmpty] => Value is required and can't be empty
)
Ok, this is a best what I could come up after researching on it. Solution is inspired by these question.
Form: hidden field and ObjectMultiCheckBox
public function init()
{
$this->setAttribute('method', 'post');
$this->setAttribute('novalidate', 'novalidate');
//hidden field to return empty value. If checkbox selected, checkbox values will be stored with empty value in Json notation
$this->add(array(
'type' => 'Hidden',
'name' => 'otherLearningExperiences[]', // imitates checkbox name
'attributes' => array(
'value' => null
)
));
$this->add(array(
// 'type' => 'Zend\Form\Element\MultiCheckbox',
'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox',
'name' => 'otherLearningExperiences',
'options' => array(
'label' => 'C. Check other learning experiences',
'object_manager' => $this->getObjectManager(),
'target_class' => 'OnlineFieldEvaluation\Entity\FieldEducationAssignments',
'property' => 'otherLearningExperiences',
'label_attributes' => array(
'id' => 'macro_practice_label',
'class' => 'control-label label-multicheckbox-group'
),
'value_options' => array(
array(
'value' => 'seminars',
'label' => 'Seminars, In-Service Training/Conferences',
'label_attributes' => array(
'class' => 'bindto',
'data-bindit_id' => 'seminarsTxt_ID'
),
'attributes' => array(
'id' => 'seminars_ID',
),
),
array(
'value' => 'other',
'label' => 'Other (specify)',
'label_attributes' => array(
'class' => 'bindto',
'data-bindit_id' => 'otherLeaningExperiencesTxt_ID'
),
'attributes' => array(
'id' => 'otherLeaningExperiences_ID',
),
)
),
),
'attributes' => array(
//'value' => '1', //set checked to '1'
'multiple' => true,
'empty_option' => '',
'required' =>false,
'allow_empty' => true,
'continue_if_empty' => false,
)
));
Validator
$inputFilter->add($factory->createInput(array(
'name' => 'otherLearningExperiences',
'required' => false,
'allow_empty' => true,
'continue_if_empty' => true,
)));
}
View
//hidden field to be posted for empty value in multicheckbox
echo $this->formHidden($form->get('otherLearningExperiences[]'));
$element = $form->get('otherLearningExperiences');
echo $this->formLabel($element);
echo $this->formMultiCheckbox($element, 'prepend');
I'm trying to create a simple application with Zend Framework 2 and now stacked at the point of adding comments form.
I have two modules "Book" and "Comment". I want to show a form for adding comments that is disposed in module "Comment" from "Books" module controller.
The problem appears when I'm trying to open forms tag.
I'm having this error : " Fatal error: Call to undefined method Comment\Form\CommentForm::openTag()".
I tried to check $this->addComment - with var_dump and everything looks great.
Can anybody help me to solve this problem ?
<div class="row">
<div class="col-xs-12 commentBlock">
<?php
if($this->addComment){
$this->addComment->prepare();
$commentFieldset = $this->addComment->get('comment');
print $this->addComment()->openTag($this->addComment);
}
?>
</div>
</div>
Here is 'Comment' module files :
Comment\Form\CommentFieldset
<?php
namespace Comment\Form;
use Comment\Entity\Comment;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
class CommentFieldset extends Fieldset implements InputFilterProviderInterface
{
public function __construct()
{
parent::__construct('comment');
$this->add(
array(
'name' => 'commentTitle',
'attributes' => array(
// 'required' => 'required',
'class' => 'form-controll',
'placeholder' => 'Введите заголовок комментария'
),
'options' => array(
'label' => 'Заголовок комментария',
'label_attributes' => array(
'class' => 'text-center col-sm-3 control-label',
),
),
)
);
$this->add(
array(
'name' => 'commentText',
'type' => 'Zend\Form\Element\Textarea',
'attributes' => array(
'required' => 'required',
'class' => 'form=-controll',
'palceholder' => 'Введите текст комментария',
),
'options' => array(
'label' => 'Текст комментария',
'label_attributes' => array(
'class' => 'text-center col-sm-3 control-label',
),
),
)
);
$this->add(
array(
'name' => 'commentType',
'type' => 'Zend\Form\Element\Radio',
'attributes' => array(
'required' => 'required',
),
'options' => array(
'label' => 'Тип комментария',
'label_attributes' => array(
'class' => 'text-center col-sm-3 control-label',
),
'value_options' => array(
'positive' => 'postive',
'neutral' => 'neutral',
'negative' => 'negative',
),
),
)
);
}
public function getInputFilterSpecification()
{
return array(
'commentTitle' => array(
'required' => FALSE,
'filters' => array(
array(
'name' => 'Zend\Filter\StripTags',
),
array(
'name' => 'Zend\Filter\HtmlEntities'
),
array(
'name' => 'Zend\Filter\StringTrim',
),
),
'validators' => array(
array(
'name' => 'Zend\Validator\StringLength',
'options' => array(
'min' => 1,
'max' => 250,
),
),
),
),
'commentText' => array(
'required' => TRUE,
'filters' => array(
array(
'name' => 'Zend\Filter\StripTags',
),
array(
'name' => 'Zend\Filter\HtmlEntities'
),
array(
'name' => 'Zend\Filter\StringTrim',
),
),
'validators' => array(
array(
'name' => '\Zend\Validator\StringLength',
'options' => array(
'min' => 1,
'max' => 1000,
),
),
),
),
'commentType' => array(
'required' => true,
'validators' => array(
array(
'name' => 'Zend\Validator\InArray',
'options' => array(
'haystack' => array(
'positive',
'neutral',
'negative',
),
'strict' =>\Zend\Validator\InArray::COMPARE_STRICT,
),
),
),
),
);
}
}
Comment\Form\CommentFieldset
<?php
namespace Comment\Form;
use Zend\Form\Form;
use Zend\InputFilter\InputFilter;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
class CommentForm extends Form
{
public function __construct()
{
parent::__construct('comment');
$this
->setAttribute('method', 'POST')
->setHydrator(new ClassMethodsHydrator())
->setInputFilter(new InputFilter())
;
$this->add(
array(
'type' => 'Comment\Form\CommentFieldset',
'options' => array(
'use_as_base_fieldset' => true,
),
)
);
$this->add(
array(
'name' => 'csrf',
'type' => 'Zend\Form\Element\Csrf',
)
);
$this->add(
array(
'name' => 'captcha',
'type' => 'Zend\Form\Element\Captcha',
'options' => array(
'label' => 'А вы точно-приточно не робот ? ',
'captcha' => new \Zend\Captcha\Figlet(),
'attributes' => array(
'required' => true,
)
),
)
);
$this->add(
array(
'name' => 'submit',
'attributes' => array(
'type' => 'submit',
'value' => 'Добавить комментарий',
'class' => 'bigSubmit btn btn-pink',
),
)
);
$this->setValidationGroup(
array(
'csrf',
'captcha',
'comment' => array(
'commentTitle',
'commentText',
'commentType',
),
)
);
}
}
Comment\View\Helper\DisplayAddCommentForm
<?php
namespace Comment\View\Helper;
use Zend\Form\View\Helper\AbstractHelper;
class DisplayAddCommentForm extends AbstractHelper
{
public function __invoke()
{
return new \Comment\Form\CommentForm();
}
}
Book\Controller\BookController
<?php
namespace Book\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\View\Model\JsonModel;
use Comment\Form\CommentForm;
class BookController extends AbstractActionController
{
protected $bookModel;
protected $commentsModel;
public function showAction()
{
$isbn = $this->params()->fromRoute('num');
$book = $this->bookModel->getU(array($isbn));
$comments = $this->commentsModel->getBookComments(array($isbn));
if($_SESSION['user']){
$commentForm = new CommentForm();
} else {
$commentForm = NULL;
}
return new ViewModel(
array(
'book' => $book,
'comments' => $comments,
'addComment' => $commentForm,
)
);
}
**************
}
openTag() is method from form view helper not from your helper. In your view script change this line : print $this->addComment()->openTag($this->addComment); to this one print $this->form()->openTag($this->addComment);
I have a requirement of rendering and processing the same form again if user check a select box. I looked into form collections but it didn't exactly access my problem because I don't need to render a set of fields instead my requirement is to render the complete form again. So what I added another function getClone($prefix) to get the clone of form which returns me the clone of form object after adding a prefix in the name of form. Like this
<?php
namespace Company\Form;
use Zend\Form\Form;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;
class CompanyAddress extends Form implements InputFilterAwareInterface {
protected $inputFilter;
public function __construct($countries, $name = 'null') {
parent::__construct('company_address');
$this->setAttribute('method', 'post');
$this->setAttribute('id', 'company_address');
$this->add(array(
'name' => 'street_1',
'attributes' => array(
'id' => 'street_1',
'type' => 'text',
),
'options' => array(
'label' => 'Street *',
)
));
$this->add(array(
'name' => 'street_2',
'attributes' => array(
'id' => 'street_2',
'type' => 'text',
),
'options' => array(
'label' => 'Street 2',
)
));
$this->add(array(
'name' => 'country_id',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'id' => 'country_id',
),
'options' => array(
'label' => 'Country',
'value_options' => $countries
)
));
$this->add(array(
'name' => 'city_id',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'id' => 'city_id',
),
'options' => array(
'label' => 'City ',
'value_options' => array()
)
));
$this->add(array(
'name' => 'zip',
'attributes' => array(
'id' => 'zip',
'type' => 'text',
),
'options' => array(
'label' => 'ZIP',
'value_options' => array()
)
));
$this->add(array(
'name' => 'address_type',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'id' => 'zip',
),
'options' => array(
'label' => 'Type',
'value_options' => array(
'' => 'Select Type',
'default' => 'Default',
'invoice' => 'Invoice',
'both' => 'Both',
)
)
));
}
public function getClone($prefix){
$form = clone $this;
foreach($form->getElements() as $element){
$name = $element->getName();
$element->setName("$prefix[$name]");
}
return $form;
}
public function getInputFilter() {
if (!$this->inputFilter) {
$inputFilter = new InputFilter();
$factory = new InputFactory();
$inputFilter->add($factory->createInput(array(
'name' => 'street_1',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'Street cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'street_2',
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'city_id',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'City cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'country_id',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'Country cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'zip',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'ZIP cannot be empty'),
),
),
)));
$inputFilter->add($factory->createInput(array(
'name' => 'address_type',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'options' => array('message' => 'Address Type cannot be empty'),
),
),
)));
$this->inputFilter = $inputFilter;
}
return $this->inputFilter;
}
}
and than in my action I did this
public function testAction() {
$countries = $this->getServiceLocator()->get('Country')->getSelect();
$companyAddressForm = new CompanyAddressForm($countries);
$clone = $companyAddressForm->getClone('address2');
if($this->request->isPost()){
$data = $this->request->getPost();
$companyAddressForm->setData($data);
$clone->setData($data['address2']);
$isFormOneValid = $companyAddressForm->isValid();
//$isFormTwoValid = $clone->isValid();
}
$view = new ViewModel();
$view->companyAddressForm = $companyAddressForm;
$view->clone = $clone;
return $view;
}
This is working as I expected it to work, forms are rendering and validating correctly, I want to know whether it is a correct way or a hack?
If both of the forms are exactly the same then you don't need to declare and validate two forms in the controller action.
Reason:
If there are two forms rendered your HTML page. Only one of the forms can be posted by the users at a time and you need to validate only one form at a time. What you are doing now is to validate the same form with the same post data over again. So either $isFormOneValid, $isFormTwoValid are both true or both false.
Instead, declare only one form, render it twice in your view, and upon post, validate it with the post data. If the two forms differ in properties, filters, validators, etc. then you can create two methods like $form->applyForm1Validarots() and $form->applyForm2Validarots, check the value of your select element, and call the appropriate method to apply the validaorts / filters before calling isValid() on it.
Hope I helped
I have set my form for validation using $form->setData().
After validation I am not receiving all of my properties back using $form->getData().
I am using following lines in controller
and somehow $form->getData() is not returning all fields anyone has any idea why?
if ($request->isPost())
{
$company = new Company();
$form->setInputFilter($company->getInputFilter());
$form->setData($request->getPost());
print_r($request->getPost()); // getPost shows all fields fine
if ($form->isvalid())
{
print_r($form->getData()); // is returning only select and text type fields which are in input filter. why?
}
}
my form is looks like this.
class Companyform extends Form
{
public function __construct()
{
parent::__construct('company');
$this->setAttribute ('method', 'post');
$this->setAttribute ('class', 'form-horizontal');
$this->add(array(
'name' => 'id',
'attributes' => array(
'type' => 'hidden'
),
));
$this->add ( array (
'name' => 'title',
'type' => 'Zend\Form\Element\Select',
'attributes' => array(
'id' => 'title',
'options' => array(
'mr' => 'Mr',
'miss' => 'Miss',
'mrs' => 'Mrs',
'dr' => 'Dr'
),
'value' => 'mr'
),
'options' => array(
'label' => 'Title'
)
));
$this->add(array(
'name' => 'fname',
'attributes' => array(
'id' => 'fname',
'type' => 'text',
'placeholder' => "First Name",
),
'options' => array(
'label' => 'First Name'
)
));
$this->add(array(
'name' => 'surname',
'attributes' => array(
'id' => 'surname',
'type' => 'text',
'placeholder' => "Surname Name",
),
'options' => array(
'label' => 'Surname Name'
)
));
$this->add(array(
'name' => 'companyName',
'attributes' => array(
'id' => 'companyName',
'type' => 'text',
'placeholder' => "Company Name",
),
'options' => array(
'label' => 'Company Name'
)
));
$this->add(array(
'name' => 'address1',
'attributes' => array(
'id' => 'address1',
'type' => 'text',
'placeholder' => "Address Line 1",
),
'options' => array(
'label' => 'Address'
)
));
$this->add(array(
'name' => 'address2',
'attributes' => array(
'id' => 'address2',
'type' => 'text',
'placeholder' => "Address Line 2",
),
'options' => array(
'label' => 'Address'
)
));
$this->add(array(
'name' => 'address3',
'attributes' => array(
'id' => 'address3',
'type' => 'text',
'placeholder' => "Address Line 3",
),
'options' => array(
'label' => 'Address'
)
));
$this->add(array(
'name' => 'btnsubmit',
'attributes' => array(
'id' => 'btnsubmit',
'type' => 'submit',
'value' => 'Add',
'class' => 'btn btn-primary'
),
));
}
}
and This is the input filter which I am using in entity company
public function setInputFilter(InputFilterInterface $inputFilter)
{
throw new \Exception("Not used");
}
public function getInputFilter()
{
if (!$this->inputFilter) {
$inputFilter = new InputFilter();
$factory = new InputFactory();
$inputFilter->add($factory->createInput(array(
'name' => 'companyName',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 2,
'max' => 255,
),
),
),
)));
$this->inputFilter = $inputFilter;
}
return $this->inputFilter;
}
Every single Form-Element has to get validated! Even if the validator is empty like
$inputFilter->add($factory->createInput(array(
'name' => 'title'
)));
Only validated data get's passed from the form.