Thanks for Your reply
but its not working . still I am getting id instead of Vehicle name.

Regards,
Naleen Yadav
www.genpro.co.in

On Fri, Nov 11, 2011 at 10:12 PM, Massimo Di Pierro <
[email protected]> wrote:

> 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 <[email protected]> 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