How do I get the FORM rendered by Ractive to submit? *CONTROLLER* def get_form(): try: user = db.auth_user(auth.user.id) fields = ['first_name', 'last_name', 'gender', 'email', 'phone'] rslt = SQLFORM(db.auth_user, user, fields=fields, showid=False, formname='auth_form', formstyle='bootstrap') except Exception, e: print(e.message)
x = request.vars.formname if rslt.process(session=None, formname='auth_form', keepvalues=True). accepted: rslt = 'Accepted' elif rslt.errors: rslt = 'Errors' return dict(auth_form=XML(rslt.xml())) @auth.requires_login() def index2(): return dict() def component_page(): return dict() *VIEW* {{extend 'layout.dash.html'}} {{=LOAD('test_ractivejs','component_page.load',ajax=True)}} *COMPONENT* <div id='container'></div> <script id='template' type='text/ractive'> [[[form_xml]]] </script> <script> var ractive = new Ractive({ delimiters: [ '[[', ']]' ], tripleDelimiters: [ '[[[', ']]]' ], el: '#container', template: '#template', data: { form_xml: '' } }); function loadForm() { $.post('{{=URL("get_form")}}', {}, function (data) { ractive.set({form_xml: data}); }); } $(function () { loadForm(); }); </script> -- 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.
web2py_api_56_ractive_01_sml.7z
Description: application/7z-compressed