It is a logical issue:

db.tableA.current.requires=IS_NULL_OR(IS_IN_DB(db
(db.tableB.parrent==db.tableA.id),'tableB.id','tableB.id',error_message="..."))

does not work because when you set the validator there is no current
record (db.tableA.id). Imagine a create form. The db.tableA.id exist
only after the record is created, not when the form is displayed.

you need to set the validator in an update form:

def update():
      id=request.args[0]
      record=db(db.tableA.id==id).select()[0]
      db.tableA.current.requires=IS_NULL_OR(IS_IN_DB(db
(db.tableB.parrent==id),'tableB.id','tableB.id',error_message="..."))
      form=SQLFORM(db.tableA,record)

Massimo




On Nov 15, 10:07 am, pigmej <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have One to Many ( tableA 2 tableB ) relation in tables. I need to
> be able choose ( in dropdown menu ) only these records from tableB
> with are related to single record from tableA
>
> In tableB I have information about related record in tableA, and in
> tableA I have one related record from tableB ( I need this relations )
>
> I tried like:
> db.tableA.current.requires=IS_NULL_OR(IS_IN_DB(db
> (db.tableB.parrent==db.tableA.id),'tableB.id','tableB.id',error_message="..."))
>
> I have no idea what should I have in db.tableB.parrent==db.tableA.id.
> With or without that is the same result ( work's fine but doesn't
> filter my results )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to