Re: QuickForm + "soft" rules.

From: Date: Fri, 27 May 2005 18:06:04 +0000
Subject: Re: QuickForm + "soft" rules.
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19390@lists.php.net to get a copy of this message
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 can > choose to override) validation rules to QuickForm objects? > > 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 formatting > so for example. > > Surname > > Rather than > > sURnaMe > > 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" hence > not being able to use a filter rule. For example the surnames > > van Blogger > al Tranger > McTaggert > > 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. > > What would be useful is to have a soft validation rule whereby, if it fails > the usual message appears along with a checkbox saying "Yes I really want to > submit this" that would override the associated rule. > > This can be done with some hacking about using groups, rules etc but it would > be nice to have a addSoftRule() method, or some such that would generate the > appropriate elements if the validation failed, and deal with overriding the > rule if the checkbox is set. > > Have people looked at this before? I imagine it is a common want. > 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. -- Justin Patrin

« previous php.pear.general (#19390) next »