<a href="#" onclick="web2py_component('{{=URL(request.application,'todo','todo_form')}}', 'mytarget');">New todo</a> <div id="mytarget"></div>
no need for def new(): On May 11, 10:16 pm, Keith Edmunds <k...@midnighthax.com> wrote: > I was to display a form using Ajax in response to a click on a link on the > page. I have tried putting this in the view: > > <a href="#" onclick="ajax( > '{{=URL(request.application, > 'todo', > 'new')}}', > [], 'DetailArea')" />New todo > </a> > > with this in the controller: > > def new(): > > return = LOAD('todo','todo_form',ajax=True) > > def todo_form(): > form = SQLFORM(db.tasks,fields=['priority','subject','duedate']) > if form.accepts(request.vars,session): > session.flash = 'record inserted' > redirect(URL(request.application,'default','index')) > return form > > ...but that doesn't work. > > I don't think I've fully understood how LOAD works - can someone point me > in the right direction, please?