Say you have two fields a and b and you want a+b to be unique. You always validate one at the time because only one can report an error. Therefore you you want to validate b so that a+b is unique:
db.table.b.requires=IS_NOT_IN_DB(db (db.table.a==request.vars.a),'table.b') On Aug 31, 10:10 am, tititi <[email protected]> wrote: > Hi, > > I'm looking at IS_IN_DB and IS_NOT_IN_DB to filter out inserts and > want to know if it's possible to use 2 fields to validate an insert to > prevent duplicates. For example, let's say I want emails to be unique > in email field, now I want it to be email AND postalcode to be unique. > I would like to use this at the model level and not a controller, is > this possible? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

