Not sure if you are still looking for the solution, i found it from another 
thread. You need to add the "keyword" for the fields which reference the 
same field in another table. Cheers!

db.define_table(
    'order_cab',
    Field('pick_up', db.location,
        widget = 
SQLFORM.widgets.autocomplete(request,db.location.street_address,limitby=(0,10), 
min_length=2), keyword='_autocomplete_cab_order_pickup'),
    Field('drop_off', db.location,
        widget = 
SQLFORM.widgets.autocomplete(request,db.location.street_address,limitby=(0,10), 
min_length=2), keyword='_autocomplete_cab_order_dropoff'),
    Field('driver', db.driver,
        widget = 
SQLFORM.widgets.autocomplete(request,db.driver.name,limitby=(0,10), 
min_length=2)),
    Field('date', 'date'),
    Field('time', 'time'))   

On Sunday, November 3, 2013 at 12:33:53 AM UTC+8, raferbop wrote:
>
> #Model
>
> db.define_table(
>     'order_cab',
>     Field('pick_up', db.location,
>         widget = 
> SQLFORM.widgets.autocomplete(request,db.location.street_address,limitby=(0,10),
>  
> min_length=2)),
>     Field('drop_off', db.location,
>         widget = 
> SQLFORM.widgets.autocomplete(request,db.location.street_address,limitby=(0,10),
>  
> min_length=2)),
>     Field('driver', db.driver,
>         widget = 
> SQLFORM.widgets.autocomplete(request,db.driver.name,limitby=(0,10), 
> min_length=2)),
>     Field('date', 'date'),
>     Field('time', 'time'))   
>
> db.define_table(
>     'location',
>     Field('street_address', type='string',
>         label=T('Street Address')),
>     Field('city', type='string',
>         label=T('City/Town')),
>     Field('state', type='string',
>         label=T('State')),    
>     Field('postal_code', type='string',
>         label=T('Postal Code')),   
>     Field('country', type='string',
>         label=T('Country')),    
>     Field('latitude', type='string',
>           writable=False,
>           label=T('Latitude')),
>     Field('longitude', type='string',
>           writable=False,
>           label=T('Longitude')))
>
> db.define_table(
>     'driver',
>     Field('id'),
>     Field('name'),
>     Field('company', db.company),
>     Field('cab_number'),
>     Field('image', 'upload'),    
>     Field('cell_number', requires=IS_MATCH('[\d\-\(\) ]+')),
>     format='%(name)s')
>
> #Controller
> def order_cab():
>     form = crud.create(db.order_cab)
>     return locals()
>
> Good morning guys,
>
> Still looking for a lil help in implementing the auto-complete widget. 
> When I start to add characters to the fields associated with the widget, I 
> get the following error message "an error occured, please reload the page". 
> I have no idea what I am doing wrong, as the code looks fine to me. Is it 
> that I am overlooking something? Your assistance will be much appreciated. 
>
>

-- 
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/d/optout.

Reply via email to