RE: [PEAR] Complex server-side rules with QuickForm
| From: | Joshua Beall | Date: | Wed, 23 Mar 2005 18:09:07 +0000 |
| Subject: | RE: [PEAR] Complex server-side rules with QuickForm | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18293@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Justin Patrin [mailto:papercrane@gmail.com]
> Sent: Wednesday, March 23, 2005 13:06
>
> On Tue, 22 Mar 2005 16:58:11 -0500, Joshua Beall
> <jbeall@heraldic.us> wrote:
> > Hi All,
> >
> > I am wanting to do "complex" server-side JS validation. I put
"complex" in
> > quotes because complex is of course in the eye of the beholder.
>
> Ok, first thing. "server-side" and "JS" are mutually exclisuve.
> Server-side rules are PHP and client-side rules are JS.
Yikes, that was a nasty typo. I meant client-side.
>
> Sounds more like you want some DHTML, not validation. You can easily
> add an onChange for the select box using:
> $el->updateAttributes('onchange' => 'someJSFunction(this)');
>
> If you want to validate that as well, the easiest way is with a
> formRule, which would be server-side only.
>
> function validateSomething($values) {
> //return true or array with error message(s)
> }
> $form->addFormRule('validateSomething');
>
> If you want to add custom JS validation I think you need to create a
> new rule type (class), register it, and add it to your form.
I understand all that, I just was wondering if QuickForm had some sort
of builtin functionality to handle the situation I described.