Jörn Zaefferer escribió:
SeViR schrieb:
Somewhere in the documentation you should find a comment stating that
the temptation to add a regex method is great, but should be resisted.
I still think that its better to add custom methods that implement
those regular expression instead of one generic regex method. By
choosing a good name for the method its very clear what is validated,
which is not easily figured by looking at a complex regular
expression. And heavily increases the chance to reuse regular
expressions.
mmm, I don't know if I think the same... On one side, a generic regexp
method allow less code
and fast rule writing, on the other side, you are right, an specific
method with a good name is more clear.
I haven't understood yet how implies works, but your code seems like a
good approach to tackle that feature. Thanks.
Logical implies a => b a is true if b is true, false in other case.
Then this is a simple example form:
(* is obligatory)
*name: ___________
*surname: ________
send by postal mail: [X] <-- checkbox
postal address: _______________
So, if I check "send by postal mail", implies that I need the postal
address, but I can write
the postal address for more information without mark the checkbox :)
The "and" and "or" method also is useful for dependences between fields.
--
Best Regards,
José Francisco Rives Lirola <sevir1ATgmail.com>
SeViR CW · Computer Design
http://www.sevir.org
Murcia - Spain