Re: Thoughts on QuickForm-additions (again)
| From: | Bertrand Mansion | Date: | Sat, 16 Aug 2003 15:45:51 +0000 |
| Subject: | Re: Thoughts on QuickForm-additions (again) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-19896@lists.php.net to get a copy of this message | ||
<stefan@neufeind.net> wrote :
> On 16 Aug 2003 at 17:27, Alexey Borzov wrote:
>
>> Stefan Neufeind wrote:
>>
>> It is already possible to do minValue and maxValue using
>> Validate::number() Haven't you looked at it?
>
> Didn't yet find a way to "registerRule" a Validate::nuimber() :-) But
> will have a look, promise. If it's just one line or two maybe you can
> help me out?
Number ?
require_once ("Validate.php");
$form->registerRule('Validate_number', 'function', 'number',
'Validate');
$form->addRule('field', 'Bad format, use this: 0.00',
'Validate_number',
array('decimal' => '.', 'dec_prec' => 2));
Date ?
require_once ("Date/Calc.php");
function Validate_date($element, $array) {
return Date_Calc::isValidDate($array['d'], $array['M'],
$array['Y']);
}
$form->registerRule('Validate_date', 'function', 'Validate_date');
$form->addRule('date', 'Wrong date', 'Validate_date');
Bertrand Mansion
Mamasam