I'm trying to change a search form that uses ajax function.

Simplifying is a form with a dropbox and a button. What I want is
instead of displaying the dropbox is showing a series of links. The
problem is that as from the link I call the ajax function (...).


I currently have the following (works well):

def buscar():
    profesiones = db().select(db.profesiones.ALL,
orderby=db.profesiones.profesion, cache=(cache.ram,3600))

    sel_profesiones = SELECT(_name='id_profesion', _id='id_profesion',
            *[OPTION(profesiones[i].profesion, _value=profesiones
[i].id) for i in range(len(profesiones))])

    form = FORM(TABLE(
            TR("Profesión:", sel_profesiones),
            TR("", INPUT(_type="button", _value="Buscar",
_id="btn_buscar",
                    _onclick="ajax('bg_buscar',['id_profesion'],
'resultado');"))
            ))

    return dict(form=form)

def bg_buscar():
    registros = None
    query = (db.profesionales.id_profesion ==
request.vars.id_profesion)
    registros = db(query).select()

    return dict(registros=registros)

i change for:

def buscar2():
    profesiones = db().select(db.profesiones.ALL,
orderby=db.profesiones.profesion, cache=(cache.ram,3600))

    return dict(profesiones=profesiones)


I do not know is how to assemble the view to call the ajax link (...).
I tried on this side but I could not do anything.

the view buscar2.html

<ul>
{{for p in profesiones:}}
    <li>{{=A(p.profesion, _id="id_%d"%p.id, _href='#', _onclick="ajax
('bg_buscar2',['id_%d'],'resultado');"%p.id)}}</li>
{{pass}}
</ul>

José

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

Reply via email to