because you have nome both in get_vars and post_vars which get
combined in vars

def search():

    form_search = SQLFORM.factory(
        Field('nome',
requires=IS_NOT_EMPTY(),default=form.get_vars.name))

    if form_search.accepts(request.post_vars, session=None,
keepvalues=True):
        redirect(URL(r=request,
f='search',vars=dict(nome=form_search.vars.nome))

    nome=request.get_vars.nome

    ... the rest unchanged ...

On Mar 2, 3:41 pm, Tito Garrido <[email protected]> wrote:
> *Hi,
>
> Im trying to create a simple search function like this:*
>
> *def search():
>
>     form_search = SQLFORM.factory(
>         Field('nome', requires=IS_NOT_EMPTY()))
>
>     if form_search.accepts(request.vars, session=None, keepvalues=True):
>         redirect(URL(r=request, f='search?nome=%s'%form_search.vars.nome))
>
>     try:
>         nome=request.vars['nome']
>     except:
>         nome=None
>
>     webgrid = local_import('webgrid')
>     grid = webgrid.WebGrid(crud)
>     grid.pagesize = 10
>     if nome:
>         grid.datasource =
> db(db.paciente.nome.upper().like('%'+nome.upper()+'%')).select()
> ....*
>
> *When I submit the form it search normally for the string that I've put on
> "nome" field, but if I search it again it creates a list o
> request.vars.nome.
>
> Example:
> First search:http://127.0.0.1:8000/app/default/search?nome=Test
> Second 
> search:http://127.0.0.1:8000/app/default/search?nome=[%27Test%27,%20%27test2%27]
>
> Is that expected?*
>
> --
>
> Linux User #387870
> .........____
> .... _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:_______

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to