Hi all, I'm having a issue with tha javascirpt load function. I'm able to see the form but when I submit the changes they are not reflected in the database. could you please help me to understand what am I doing wrong?
Following is a simple example (model, view and controller) Model: db.define_table('objetivos', Field('parent','reference objetivos',default=None), Field('title','string',requires=IS_NOT_EMPTY()), format = '%(objetivos)s') Controller: import gluon import json def edit(): form = SQLFORM(db.objetivos,request.args(0)) if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill the form' # Note: no form instance is passed to the view return dict(form=form) View: {{include 'web2py_ajax.html'}} <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ url="http://XXXXX:8000/BP/BP/edit/22"; $("#dialog-form").load(url,function(responseTxt,statusTxt,xhr){ if(statusTxt=="success") alert("External content loaded successfully!"); if(statusTxt=="error") alert("Error: "+xhr.status+": "+xhr.statusText); }); }); }); </script> </head> <body> <div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div> <button>Open</button> <div id="dialog-form" title="Objetivo"></div> </body> </html> -- 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/groups/opt_out.