On Monday, June 13, 2011 6:21:01 PM UTC-4, sebastian wrote:
>
> anyway I would suggest to use ajax=true until
> http://code.google.com/p/web2py/issues/detail?id=286 is fixed
>
I'm not sure issue 286 is really a problem. ajax_trap is for trapping forms
within components, not for trapping links. If you want to trap a link within
a component, you just have to know the div id of the component. When
ajax=True, the div id is stored in request.cid, so you can specify
cid=request.cid in the A() helper, as you did in your example. However, when
ajax=False, the div id is not stored in request.cid. In that case, you can
specify your own div id via the 'target' argument to LOAD(). So, you would
do:
{{=LOAD(f="testajax.load",target='testajax',ajax=False)}}
In testajax.load
{{=A('click me', _href=URL('testajax.load'),cid='testajax')}}
Alternatively, you can get the automatically generated component id from
request.env.http_web2py_component_element, so you could do:
{{=A('click me',
_href=URL('testajax.load'),cid=request.env.http_web2py_component_element)}}
In any case, perhaps web2py should assign the component id to request.cid
even when ajax=False.
Anthony