From: Alexey Borzov on
Hi Christian,

On 12.06.2010 13:38, Christian Weiske wrote:
> 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?

A good catch: the Rules on Containers are called before the Rules on the
elements they contain, so you can't really check whether the elements are
valid... We should probably change that order, form rules in HTML_QuickForm were
called last, after all element-specific ones.
From: Christian Weiske on
Hi Alexey,


> A good catch: the Rules on Containers are called before the Rules on
> the elements they contain, so you can't really check whether the
> elements are valid... We should probably change that order, form
> rules in HTML_QuickForm were called last, after all element-specific
> ones.

I opened a bug for this:
http://pear.php.net/bugs/bug.php?id=17576

--
Regards/Mit freundlichen Grüßen
Christian Weiske

-=≡ Geeking around in the name of science since 1982 ≡=-