Re: Re: [QuickForm][Controller/Page] register(methodic)Rule();
| From: | Bertrand Mansion | Date: | Wed, 01 Oct 2003 10:25:41 +0000 |
| Subject: | Re: Re: [QuickForm][Controller/Page] register(methodic)Rule(); | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8170@lists.php.net to get a copy of this message | ||
<usenet@risse.org> wrote :
> of course this must be:
>
> <?php
> // add element/group
> $list_sixMAgo[] = &HTML_QuickForm::createElement('radio', null, null,
> 'Ja', '1');
> $list_sixMAgo[] = &HTML_QuickForm::createElement('radio', null, null,
> 'Nein', '0');
> $this->addGroup($list_sixMAgo, 'sixMAgo', 'This is my label');
> ?>
>
> .. and ..
>
> <?php
> // add rule
> // $this->addRule('sixMAgo', 'This one here didnt pass the superCheck',
> 'superCheck');
> ?>
>
> ,but the prob is still the same.
>
> hope i am not confusing you too much.
Probably your method should be :
function superCheck($value, $option = null)
{
...
return true;
}
There is a difference between using a method and using a function for
validation. A method accepts 2 parameters and a function accepts 3
parameters, the first one being the element name.
I agree that this is not very logical and I don't remember why it's like
this. The good news is that we will soon have (well, it's already there in
CVS) a new 'callback' rule type which will accept only 2 parameters in both
cases. I plan on keeping 'function' for BC.
HTH
Bertrand Mansion
Mamasam