Re: [QF]caused rules
| From: | Justin Patrin | Date: | Fri, 07 Jan 2005 20:57:31 +0000 |
| Subject: | Re: [QF]caused rules | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16799@lists.php.net to get a copy of this message | ||
On Fri, 7 Jan 2005 14:56:33 +0100, Alexander Petri <alex.petri@gmx.de> wrote:
> i have 2 fields (there are more than 2, but unnessesary for this question)
> in my form
> the first is an emailfield
> and the second is a radiobutton group
> called "do you want to get a newsletter?" -> yes/no
>
> my problem is that if a user dont want to get a newsletter
> the email should not be required
> i do it the similar way like the code below:
>
> function checkPerMailAndEmail($values){
> if(strlen($values["email"])<2 &&
> $values["newsletter_per_post"]==0)
> $GLOBALS["langStr"][LANG]['rules_email_2'];
> return empty($errors)? true: $errors;
> }
>
> but is there another way to do that?
>
The only way I know if is to use a callback rule, as you specified
above. What kind of other way di you want?
--
Justin Patrin