On Apr 2, 7:14 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> db.table.field1.requires=IS_NULL_OR(IS_IPV4())
> db.table.field2.requires=IS_NULL_OR(IS_IPV4()) if request.vars.field1
> else IS_IPV4()

Thank you for this, Massimo - this is a nice, compact idiom for using
existing validators; I hadn't considered (don't know why not - it's
obvious looking at it) this idiom in assigning to a "requires" field.

My approach is more general - ANY situation where you want to do some
combinatorial logic, or external checking: form.accepts( ...,
dbio=False)...

Good question, Jonathan! :-)

- Yarko

>
> On Apr 2, 10:32 am, Jonathan Lundell <jlund...@pobox.com> wrote:
>
> > I think I've seen an answer to this one, but I can't find it.
>
> > I've got a form with two Field's, both IS_IPV4(). The validation I'm after 
> > is that one or both must be present; the only invalid case is both of them 
> > null.
>
> > How do I write that?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to