Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.3.2

Request #17575 "On empty elements validation" - validation must be more flexibility.
Submitted: 2010-07-09 01:45 UTC
From: sverel Assigned:
Status: Bogus Package: HTML_QuickForm2 (version 0.4.0)
PHP Version: 5.2.12 OS: WinXP
Roadmaps: (Not assigned)    
Subscription  


 [2010-07-09 01:45 UTC] sverel (Roman Petrov)
Description: ------------ I try make my feedback form. That form have two fields: phone and e-mail. No one of them is not required, but user must fill one of them. If user leave emty both, then error: "u must fill phone _OR_ mail". I try addRule() to one of the formElement and validate by my callback function, BUT: "If the element is empty, no validation rules other than required are checked for it. This means that empty element can be invalid only when it is required. " Becouse both fields is empty, my callback rule doesn't checked and form is valid.

Comments

 [2010-07-09 02:19 UTC] mansion (Bertrand Mansion)
-Status: Open +Status: Bogus
Have a look at the builtin-rules.php example file, it contains an example of that. You have to use the 'empty' rule and add rules using and_() or or_()