Issues

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

What is the error?

The default "Value is required and can't be empty"

Can you dump the array that is being passed to the input filter, please, so we can verify the value is not present?

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