db.define_table(
    'route',
    Field('city'),
    Field('country_iso'))


db.define_table(
    'order_bus',
    Field('depart_from', db.route),
    Field('arrive_to', db.route),
    Field('date', 'date'),
    Field('time', db.depature_times), # drop-down select time options
    Field('no_of_passengers', db.tickets), # drop-down options to select 
number of positions
    Field('posted_on', 'datetime', readable=False, writable=False),
    Field('posted_by', readable=False, writable=False))

db.order_bus.time.requires = IS_IN_DB(db, 'depature_times.id', '%(time)s', 
zero=T('Select Time')) 

db.order_bus.depart_from.widget = SQLFORM.widgets.autocomplete(request, 
db.route.city, limitby=(0,10), min_length=2)

db.order_bus.arrive_to.widget = SQLFORM.widgets.autocomplete(request, 
db.route.city, limitby=(0,10), min_length=2)

db.order_bus.depart_from.requires = IS_IN_DB(db, 'route.city', zero='')

db.order_bus.arrive_to.requires = IS_IN_DB(db, 'route.city', zero='')

db.order_bus.no_of_passengers.requires = IS_IN_DB(db, 'tickets.id', 
'%(people)s', zero=T('Passengers'))


The route DB looks like this;

route.id   route.city              route.iso
1            Washington DC     US
2            New York City       US
3            Miami                   US
4            Atlanta                  US




Good day guys,

The above model is based on a form that I created. Everything works just 
fine, except that when I submit the form, the depart_from and arrive_to 
fields have a 0 value. How can I get those fields to display either the 
route.id or route.city?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to