assuming your controller receives some request.vars.search that contains
the term to search for, it's actually pretty easy....
term = request.vars.search
tb = db.yourtable
look_into = [fixed list of fields]
#or something like
look_into = [field for field in tb.fields if tb[field].readable and tb[field
].type in ('text', 'list:string', 'string')]
query = reduce(lambda a,b: a|b, [tb[field].contains(term) for field inlook_into
])
resultset = db(query).select()
On Tuesday, August 6, 2013 2:23:03 PM UTC+2, sasogeek wrote:
>
> making a search form using crud is quite simple with the
> crud.search(db.table) function. but that returns a search field for all the
> fields in the table. how do i make one search field (a 'search bar') that
> searches all the fields using the select option 'contains' or any of the
> given options when a search query is to be made?
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.