For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2005 > Re: [PEAR] QuickForm + "soft" rules.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] QuickForm + "soft" rules.
Justin Patrin

2005-05-27, 8:56 pm

On 5/27/05, Edward Grace <ej.grace@imperial.ac.uk> wrote:
> Has anyone else come across the need to add "soft" (rules that the user c=

an
> choose to override) validation rules to QuickForm objects?
>=20
> What I mean by this is a typical scenario where you may have a rule that
> checks that a person has entered their name according to some case format=

ting
> so for example.
>=20
> Surname
>=20
> Rather than
>=20
> sURnaMe
>=20
> There are however situations where the case formatting of a surname could=

not
> fit into the typical box of "capital first letter, the rest lowercase" he=

nce
> not being able to use a filter rule. For example the surnames
>=20
> van Blogger
> al Tranger
> McTaggert
>=20
> Clearly break this "convention". Of course one could add exceptions for
> "van", "al" "Mc" prefixes but you still can't guarentee catching them all
> with a "strong" validation rule.
>=20
> What would be useful is to have a soft validation rule whereby, if it fai=

ls
> the usual message appears along with a checkbox saying "Yes I really want=

to
> submit this" that would override the associated rule.
>=20
> This can be done with some hacking about using groups, rules etc but it w=

ould
> be nice to have a addSoftRule() method, or some such that would generate =

the
> appropriate elements if the validation failed, and deal with overriding t=

he
> rule if the checkbox is set.
>=20
> Have people looked at this before? I imagine it is a common want.
>=20


Sounds like a great idea. In fact, it's a *little* like the
preValidationCallback option I added to my SubForm element. I'll see
if I can find a few minutes to see if I can hack something up.

--=20
Justin Patrin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com