hi all, if i set an $element = Zend_Form_Elenemt(); $element->setRequired(true); to be required and the user inputs '0', the $element->isValid() returns false.
this is due to the implementation of the Zend_Validate_NotEmpty validator, that checks if a value is empty($value).
empty('0'); // => falsethe Zend_Validate_NotEmpty has been addressed both in the bugtracker [1] and the mailinglist [2]. as it seems, the implementation of the Zend_Validate_NotEmpty is not likely to change, taken the fact that it was intended to map the native php function empty() [3].
but the problem remains. my user inputs 0 (say the number of children he has) and the system tells him to fill out the form ;) it wont take 0 for an answer...
to sum it up, here are some of my questions: * is this considered a problem? * should NotEmpty be changed after all? * should we implement a NotNull validator? yours. pierre spring. who really enjoys working with the zFramework. == [1] http://framework.zend.com/issues/browse/ZF-2851 [2] http://www.nabble.com/Zend_Validate_NotEmpty-special-case-to-handle-%270%27-td15232397.html#a15232397 [3] http://php.net/manual/en/function.empty.php -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
PGP.sig
Description: This is a digitally signed message part