Changes between Version 3 and Version 4 of IS_ONE_OF
- Timestamp:
- 08/23/09 13:13:45 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IS_ONE_OF
v3 v4 1 1 = IS_ONE_OF Validator = 2 2 3 The IS_ONE_OF()validator is a custom version of web2py's IS_IN_DB() for foreign key lookups in a key table. In forms, the respective field will be rendered as a drop-down field.3 The '''IS_ONE_OF()''' validator is a custom version of web2py's IS_IN_DB() for foreign key lookups in a key table. In forms, the respective field will be rendered as a drop-down field. 4 4 5 5 Other than IS_IN_DB, the IS_ONE_OF validator is deletion status sensitive, i.e. records in the key table that are flagged as 'deleted' will be ignored. … … 8 8 9 9 Usage: 10 db.table.field.requires = IS_ NULL_OR(IS_ONE_OF(db, ''"keytable.keyfield"'', ''represent'', filterby=''"fieldname"'', filter_opts=''options''))10 db.table.field.requires = IS_ONE_OF(db, ''"keytable.keyfield"'', ''represent'', filterby=''"fieldname"'', filter_opts=''options'') 11 11 12 12 - ''keytable'' = Name of the key table … … 22 22 - Without represent and if no 'name' field can be detected in the table, the keyfield itself will be used as option label. 23 23 - If filterby is specified, the drop-down fields get sorted by this field. 24 - IS_ONE_OF can be cascaded through IS_NULL_OR to include empty selection 24 25 25 26 Example: