Re: QuickForm group validation rules
| From: | Alexey Borzov | Date: | Fri, 19 Aug 2005 08:56:15 +0000 |
| Subject: | Re: QuickForm group validation rules | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20480@lists.php.net to get a copy of this message | ||
Hi,
Andrew Zahra wrote:
No, it is exactly case b) and you would spot that one immediately if you developed with error_reporting set to display notices!I've seen all types of weird behaviour and noticed a following tendency: if a person claims a bug in QuickForm without showing the code to trigger it then a) he is too ashamed to show his code due to its low quality; b) the bug is actually within his code and extremely easy to spot.Or c) its a lot of work to extract a good example and he was hoping someone might have had the same problem :)
// only mandatory if married if ($regType == 'cm') { $wedrq = 'Please provide your wedding date'; $wedinv = 'Please enter a valid date';See: you only define a validation message here if the field is required!
$this->addRule('wedDate', $wedrq, 'required', null, CV);This is wrong also, you should use addGroupRule(). Though it is irrelevant to the error in question.
}
$this->registerRule('groupdate', null, 'ValidateDateGroupRule');
$this->addRule('wedDate', $wedinv, 'groupdate', null, CV);
A notice is raised here but you don't see it. Validation runs as expected but the error message is not disoplayed since it is effectively null and renderer thinks there is no error to display.
P.S. Develop with E_NOTICE and get yourself a debugger. In that case you'll waste less time (other people's included) than now.