I will check out your suggestions, however for now i have solved like this
SOLVED WITH THIS:
db.define_table('timecard',
Field('tc_date','date'),
Field('employee', 'reference
employee',requires=IS_IN_DB(db,'employee.id','%(fname)s %(lname)s')),
Fie
Instead of creating a redundant computed field, you can use this method to
ensure a unique combinations of two
fields: https://groups.google.com/d/msg/web2py/CRPySzABQTk/8jylUabyFTQJ. Or
as Massimo suggested, use an onvalidation function.
Anthony
On Friday, November 29, 2013 7:11:19 PM UTC-5,
validation (requires) is applied at the level of form processing not
database.
In your case myid is a computed field, therefore it is not inserted in a
form and validation is not performed.
Another way to think about it is this. If there were a validation error in
a computed field, where would
3 matches
Mail list logo