I've got the following table definition.

def set_requirement(edg_edge): db.edg_edge.label.requires=[IS_IN_DB(db_st, 
'st_edge_label.name', '%(name)s', zero=T("Select a value")), 
IS_NOT_IN_DB(db((db.edg_edge.fromID==request.vars.fromID) & 
(db.edg_edge.toID==request.vars.toID)), db.edg_edge.label, 
error_message='Realtie al in database')]

db.define_table('edg_edge',
    Field('fromID', 'reference vtx_vertex', default='', 
requires=[IS_IN_DB(db, 'vtx_vertex.id', '%(name)s', zero=T("Select a 
value"))], notnull=True),
    Field('toID', 'reference vtx_vertex', default='', 
requires=[IS_IN_DB(db, 'vtx_vertex.id', '%(name)s', zero=T("Select a 
value"))], notnull=True'),
    Field('label', length=128, default='', notnull=True, 
widget=SQLFORM.widgets.options.widget),
    on_define = set_requirement,
    migrate = False)

To prevent the user form entering the same edge twice I defined the 3 field 
validator. However it does not
work and I do not see what's wrong with my code.

The user can enter:

fromID    toID    label

2             3         sponsor
2             3         sponsor

which the validator should prevent.


Kind regards,

Annet

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to