Hi,
I'm bringing back this very old post because I'm dealing with this exact 
issue right now.

So I have a db.table.field1.requires=IS_EMPTY_OR(IS_NOT_IN_DB(db, 
'table.field1')) but I have a problem with this:
when inserting a new record it works flawlessly,
instead when updating another record "field2" in the same table, the 
validators are called again on "field1" and I cannot update the record 
because I get the error Value already in database or empty
of course it's already in the database, I'm updating the same table!!

It's quite difficult to explain but I hope you got my point. Basically I 
don't want the validator to be called on "update()" but only on "insert()"

Any advice on how to deal with this situation?

Claudio

Il giorno venerdì 4 giugno 2010 07:47:58 UTC+2, mdipierro ha scritto:
>
> db.table.field.requires=IS_NULL_OR(IS_NOT_IN_DB(db, 'table.field')) 
>
> On Jun 3, 11:31 pm, dlin <dlin...@gmail.com> wrote: 
> > There is a field which I want user to enter different answer, or just 
> > keep in empty. 
> > 
> > I've tried by: 
> > 
> > db.table.field.requires=IS_NOT_IN_DB(db, 'table.field') 
> > 
> > But, it will failed, if the second empty field entered. 
> > 
> > How could I do the validation for this case? 
> > Is there any method?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to