> > #Validators > * db.worker.w_status.requires = IS_IN_DB(db,db.status.s_code) # This > created drop down but does not insert the right value into field* >
Because w_status is a reference field, it must store the record ID from the db.status table, not the s_code value (which is a text field). If you want the dropdown to display the s_code values, you must use the "label" argument (which is the third argument): IS_IN_DB(db, db.status.id, '%(s_code)s') However, there is an easier way. In your model definitions, (1) define the status table *before* the worker table (usually a good idea to define referenced tables before the tables that reference them) and (2) in the status table definition, add format='%(s_code)s'. If you do that, you don't have to define a validator for the w_status field at all -- it will automatically get a default validator like the one specified above. Anthony > -- 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.