[QF]caused rules
| From: | Alexander Petri | Date: | Fri, 07 Jan 2005 13:56:33 +0000 |
| Subject: | [QF]caused rules | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16778@lists.php.net to get a copy of this message | ||
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?