On 9 April 2014 17:45, Claudio Cocciarelli <claudiococciare...@gmail.com>wrote:


> 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?
>
>
If you want the items in field1 to be uinique then you cannot allow update
to put a duplicate value in there.

If you get that message, find the duplicate value in the database and do
something about that.

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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