Hi, wanted to ask the community if the approach I am taking is sound. If so this may be of use to others. If not, please tell me the way to do this correctly. My objective is to have form submission in a modal way (using bootstrap modal). Here is the approach I am taking, reduced to the simplest case, which works fine but may not be the most elegant:
db.py: db = DAL('sqlite://storage.sqlite') db.define_table('person', Field('firstname','string'), Field('lastname','string')) default.py def index(): button = A("modal form", _href="#myModal", _role="button", _class="btn" , **{'_data-toggle':'modal'}) return dict(button=button) def modal_form(): form = SQLFORM(db.person) form.element(_type='submit')['_onclick']= "jQuery('#myModal').modal('hide')" if form.process().accepted: response.flash = 'Accepted! %s %s added' %(form.vars.firstname, form .vars.lastname) return dict(form=form) default/index.html {{extend 'layout.html'}} {{=button}} <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden ="true">×</button> <h3 id="myModalLabel">Modal header</h3> </div> <div class="modal-body"> {{=LOAD('default','modal_form.load', ajax=True)}} </div> </div> default/modal_form.load {{=form}} any feedback of a better or more modular approach would be appreciated Ideally, I would like the complete myModal div to be the loaded component but I was not able to figure out how to do this. Thanks! -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.