Hey everyone,

Thank you so much for your help on my previous issues.

I am trying to create a global search form.  I followed Massimo's
example on the social networking example to get a great form working.
I then embedded it in a model and posted the view into my common
layout.   I followed the slice for the autocomplete widget as well.

However, everytime I submit a DIFFERENT form on the same page, it
posts an error.

I assume that somehow I need to get a form ID as SQLFORM uses. I tried
to create a sqlform.factory field, but I don't know how to set the
attributes _onkeyup and autocomplete in the form.

1.) If I make it a sqlform.factory form, will that fix the submission
problem?
2.) If not, any suggestions on how to do this correctly?

Here is my code in the model.

searchform=FORM(
        INPUT(_type="text", _id="person", _name="person",
_onkeyup="getData(this.value);", autocomplete="off"),
        INPUT(_type="submit", _value="Search"))
    searchform['_action']=URL('people','search')
    if searchform.accepts(request.vars):
        tokens=searchform.vars.person.split()
        query = reduce(lambda a,b:a&b,
[db.auth_user.first_name.contains(k)|
db.auth_user.last_name.contains(k) for k in tokens])
        res_people=db(query).select()
    else:
        res_people=[]

Reply via email to