How to make Autocomplete widget limit results based on previous fields?

22 views
Skip to first unread message

H. Das

unread,
Apr 12, 2016, 11:32:59 PM4/12/16
to web...@googlegroups.com
Hi, 

Currently I have a table defined like so:

db.define_table("patient",
    Field('first_name'),
    Field('last_name'),
    Field('date_of_birth', 'date'),
)

db.patient.first_name.widget=SQLFORM.widgets.autocomplete(request, db.patient.first_name, limitby=(0,10), min_length=1)
db.patient.last_name.widget=SQLFORM.widgets.autocomplete(request, db.patient.last_name, limitby=(0,10), min_length=1)
db.patient.date_of_birth.widget=SQLFORM.widgets.autocomplete(request, db.patient.date_of_birth, limitby=(0,10), min_length=1)

I want it to be that, after I type inside the first_name form field, when I type inside the last_name form field, the autocomplete results for last_name should be limited to rows where db.patient.first_name == <whatever was typed in first_name field>. Is there any way to customize the Autocomplete widget to do this? Thanks!
Reply all
Reply to author
Forward
0 new messages