>From Burno'e example

db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id')

is optiona and automatic. If you add it it overrides the format so you
want to do

db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db,
'tblVehicle.id',format=lambda row: "%s" %
row.**VehicleName_id.VehicleName)

On Nov 11, 12:17 am, Bruno Rocha <rochacbr...@gmail.com> wrote:
> *or you can try:*
>
> db.define_table("tblVehicle",
>       Field("*VehicleName_id*",db.tblVehicleName,label='Vehicle Name'),
>       Field("VehicleNo", default=None,label='VehicleNo'),
>       format=*lambda row: "%s" % row.**VehicleName_id.VehicleName* )
> db.tblVehicle.VehicleName.requires=IS_IN_DB(db,'tblVehicleName.id','%(
> VehicleName)s')
>
> * # Creating tblDriver adding Driver name and selecting the name of vehicle
> from the dropdown*
>
> db.define_table("tblDriver",
>       Field("DriverName",'string',label='Driver Name'),
>       Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name'))
> db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id')
>
> By thw way you have problem with the name you give to the fields, try to
> name references with *tablename_id* to avoid confusion.
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]

Reply via email to