On Jan 19, 1:34 pm, "hamdy.a.farag" <hamdy.a.fa...@inbox.com> wrote: > So this's a bug ? Rigid but not a bug.
> Is not any way to handle this ? Yes, you can create your own validator. A slightly modified version of IS_INT_IN_RANGE will do. > and for my other problem > > thanks for the link , but what I rellay need to do is to query > database based on a value of another field and fetch a value out of > there then compare it with the value in the current field > > so I need to do something like :- db.table.field = IS_EXPR('value< db > (db.auth_user.name == "%s").slelect(db.auth_user.number) > [0].number'%request.vars.other_field_value) > > it turned out that I need to surround the query with eval(), but I > failed to get things work since I'd many nested quotes that I needed > to handle but in the end I failed > > so is this right ? It would be nice if you could use IS_EXPR like that but its environment only knows about 'value'. Try an onvalidation function, something like: def your_action(): def checkit(f): r=db(db.table.field1==f.vars.field1).select() if len(r)!=1 or f.vars.field2!=r[0].field2: f.errors.field2='no match' ... if form.accepts(request.vars,onvalidation=checkit): ... Denes
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.