Mira este ejmplo, cuando seleccionas una opcion nueva llama a un
controlador via ajax e inserta la respuesta en un div :
dos funciones en el controlador para este ejemplo :
*def index(): form = SQLFORM.factory(Field('opciones', \
requires=IS_IN_SET(['opcion1', 'opcion2', 'opcion3']))) return
dict(form=form)def callback(): req = request.args(0) return req*
luego la vista index.html
*{{extend 'layout.html'}}{{=form}}<div id='ajx'></div><script>
jQuery('select[name=opciones]').on('change', function() { var
nombre=$(this).val(); var dataString = nombre; $.ajax ({ type:
"POST", url: "{{=URL('callback')}}/" + dataString, data:
dataString, cache: false, success: function(html) {
$("#ajx").html(html); } });});</script>*
Espero que te sirva de guia este ejemplo.... DIme si te funciono !!!
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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.