Issues

ZF-9896: Zend_Form::getValidValues(): dont't return values for ignored elements

Issue Type: Improvement Created: 2010-05-27T02:33:52.000+0000 Last Updated: 2010-05-27T08:48:55.000+0000 Status: Resolved Fix version(s): - 1.10.6 (22/Jun/10)

Reporter: Alexey Pakhomov (alpaxo) Assignee: Christian Albrecht (alab) Tags: - Zend_Form

Related issues: Attachments:

Description

addElement(new Zend\_Form\_Element\_Text('integer', array( 'label' => 'Integer value', 'required' => true, 'filters' => array('Int'), 'validators'=> array( array('GreaterThan', false, array('min' => 0)) ) ))); $form->addElement(new Zend\_Form\_Element\_Submit('submit', array( 'label' => 'Submit form', 'required'=> false, 'ignore'=> true ))); $validValues = $form->getValidValues(array( 'integer' => '2z', 'submit' => 'Submit form' )); ?> expect: Array ( [integer] => 2 ) but got: Array ( [integer] => 2 [submit] => Submit form )

Comments

Posted by Christian Albrecht (alab) on 2010-05-27T03:15:01.000+0000

Implemented in trunk r22309 and merged into 1.10 release

Posted by Matthew Weier O'Phinney (matthew) on 2010-05-27T05:59:29.000+0000

Actually, Christian, please revert the patch.

When an element is marked as "ignore", the intention is that getValues() and getValidValues() should not return that element -- that's the whole purpose of the "ignore" flag in the first place. The idea is that for elements that have no purpose in your model -- such as submit and reset buttons -- you can flag them as "ignore" so that the values will not be aggregated.

If you want the value, simply don't flag it to "ignore".

Posted by Alexey Pakhomov (alpaxo) on 2010-05-27T07:01:12.000+0000

Yes, Matthew. Exactly same behavior I expect. But in recent release "ignore" flag is ignored. As I can see in trunk this was fixed with checking for

if (!$element->getIgnore()) { ... }

Posted by Christian Albrecht (alab) on 2010-05-27T07:32:47.000+0000

Matthew, maybe that was due to my not so perfect english - the commit message was make ... not collect ...

This functionality was either lost somewhere at the bughunt in april, or wasn't implemented in getValidValues() before.

So now after the patch applied the behaviour is exactly what you want it to be :D

Posted by Matthew Weier O'Phinney (matthew) on 2010-05-27T08:48:54.000+0000

Christian -- awesome! Yeah, the verbiage had me confused, so I wanted to double-check.

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