For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2005 > 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 QuickForm + "soft" rules.
Edward Grace

2005-05-27, 8:56 am

=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Has anyone else come across the need to add "soft" (rules that the user can=
=20
choose to override) validation rules to QuickForm objects?

What I mean by this is a typical scenario where you may have a rule that=20
checks that a person has entered their name according to some case formatti=
ng=20
so for example.

Surname

Rather than=20

sURnaMe

There are however situations where the case formatting of a surname could n=
ot=20
fit into the typical box of "capital first letter, the rest lowercase" henc=
e=20
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=20
"van", "al" "Mc" prefixes but you still can't guarentee catching them all=20
with a "strong" validation rule.

What would be useful is to have a soft validation rule whereby, if it fails=
=20
the usual message appears along with a checkbox saying "Yes I really want t=
o=20
submit this" that would override the associated rule.

This can be done with some hacking about using groups, rules etc but it wou=
ld=20
be nice to have a addSoftRule() method, or some such that would generate th=
e=20
appropriate elements if the validation failed, and deal with overriding the=
=20
rule if the checkbox is set.

Have people looked at this before? I imagine it is a common want.

=2D -ed
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFClt7Q+i4TdNhCMrYRAq7qAJ9Ird36hvhz
/LnH8gtuWKZyvJFEVwCgqJsD
dOClJ/cem4dOvT5gd8wYvt4=3D
=3D7mvS
=2D----END PGP SIGNATURE-----
Sponsored Links







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

Copyright 2008 codecomments.com