HTML_QuickForm2: Form rule to validate a combination of two fields
| From: | Christian Weiske | Date: | Sat, 12 Jun 2010 09:38:10 +0000 |
| Subject: | HTML_QuickForm2: Form rule to validate a combination of two fields | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-30612@lists.php.net to get a copy of this message | ||
Hi all,
I have a "you forgot your password" form containing:
- Username field
- Email field
- Captcha
- Submit button
Both username and email input elements have several rules attached that
validate the respective values.
Now I want to create a rule that validates that the username-email
combination really exists.
At first, I added a form rule callback so I get all form value passed.
There I can validate username and email myself. The problem I am facing
is that the rule gets called even if the fields themselves are not
valid. That means I have to do validation of username and email values
in my form rule callback method; something that doubles much code.
Is there a solution to that problem?
Can I get the form rule called only when the fields are valid?
--
Regards/Mit freundlichen Grüßen
Christian Weiske
-=≡ Geeking around in the name of science since 1982 ≡=-
Attachment: [application/pgp-signature] signature.asc
Attachment: [application/pgp-signature] signature.asc