Actually, it's the opposite -- setting ajax_trap is only relevant when ajax=False (when ajax=True, ajax_trap is ignored because forms are automatically submitted via ajax). ajax_trap is for cases when you don't want the component to use ajax to load, but you do want any forms within the component to be submitted (to the component's controller function) via ajax.
I think you're problem is that you've spelled the argument incorrectly -- it's ajax_trap, not ajaxTrap. Anthony On Tuesday, September 27, 2011 10:20:11 AM UTC-4, Richard wrote: > > If I remember, you need ajax true for ajaxtrap to works... Both parameters > are not working independently... On old web2py version it append to me that > both were having different behavior depending if ajax = true or false, but > now it seems that ajaxtrap only trigger on when you have ajax = true. > > It's not correctly decomented in the book I think or it confusing I had > hard time last time I try to make work my component correctly. > > Richard > > On Sat, Sep 24, 2011 at 3:08 PM, apple <[email protected]> wrote: > >> When call singleview and submit the form it should print singleview, >> edit, edit. However it prints singleview, edit, singleview, edit. Why >> is the submit not trapped and sent via ajax to the edit controller? >> >> controller..... >> >> def edit(): >> print("edit") >> table=db["customer"] >> form=SQLFORM(table,1) >> return dict(form=XML(form)) >> >> def singleview(): >> print("singleview") >> return dict() >> ************************* >> edit.load... >> >> {{=form}} >> **************************** >> singleview.... >> >> {{extend 'layout.html'}} >> {{=LOAD(f='edit.load', ajax=False, ajaxTrap=True)}} >> > >

