ZF2-329: Cant set validator to ignore empty variables
Description
When I POST an empty form field the validator return error and break the process.
This is one of the variation I tried:
$this->add($factory->createInput(array(
'name' => 'based_on_activity_id',
'required' => false,
'allow_empty'=> true,
'validators' => array(
array(
'name' => 'Digits',
'options' => array(
'allowEmpty' => true,
'required' => false,
'messages' => array(
'notDigits' => "based_on_activity_id accept only integers",
),
),
),
),
)));
Comments
Posted by Maks 3w (maks3w) on 2012-07-26T20:03:34.000+0000
What is the error?
Posted by Michael Ben-Nes (mbn_18) on 2012-07-26T21:06:02.000+0000
The default "Value is required and can't be empty"
Posted by Matthew Weier O'Phinney (matthew) on 2012-07-26T21:08:21.000+0000
Can you dump the array that is being passed to the input filter, please, so we can verify the value is not present?
Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:14.000+0000
This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2487