Issues

ZF2-329: Cant set validator to ignore empty variables

Issue Type: Bug Created: 2012-05-30T09:47:20.000+0000 Last Updated: 2012-10-08T20:15:14.000+0000 Status: Closed Fix version(s): Reporter: Michael Ben-Nes (mbn_18) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Form

  • form
  • validator
  • zf2

Related issues: Attachments:

Description

When I POST an empty form field the validator return error and break the process.

This is one of the variation I tried:

<pre class="highlight">
$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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts