Now I encounter a difference between a LOAD and a link like the following: <li>{{=A(T("Add " + session.im_labels['vpu']) ,_href=URL('internal','add_entity.load', vars=dict(com=com, sif=sif)), ajax=True, cid='internal_data_div') }}</li>
I assume this link is equal to {{=LOAD('internal','add_entity.load', vars=dict(com=com, sif=sif)), ajax=True, cid='internal_data_div') }} But a form acceptance defined in this add_entity form does not react on the response.js if form_add_entity.process(form_name='add_entity').accepted: response.js= '$web2py.component("%s", target="navigation_div");' % URL('default', 'navigation.load') In other words I want to load a component bij accepting a form in another component. These components are part of index.html. The conditional load Anthony suggested will not work now because index.html is not rendered. Richard On Monday, June 30, 2014 8:17:45 PM UTC+2, Richard wrote: > > Anthony, > > Thank you for the clu: an ajax call is needed, I tried without, just > pushing javascript and HTML to the view. > > Regards, > Richard > > On Monday, June 30, 2014 4:43:06 PM UTC+2, Anthony wrote: >> >> Note, response.js only works with Ajax requests, so it will have no >> effect in this case. Instead, just use the LOAD helper, and include it >> conditionally in the view: >> >> In views/default/index.html: >> >> {{if form.accepted:}} >> {{=LOAD('default', 'graph1.load', ajax=True)}} >> {{pass}} >> >> Anthony >> >> On Monday, June 30, 2014 8:23:53 AM UTC-4, Richard wrote: >>> >>> >>> Dear web2py colleague, >>> >>> I am struggling with the response.js in order to load a component. >>> >>> Loading a component through {{=LOAD....}} works fine. >>> We want to load that component after accepting and processing a form. So >>> i put a named div in the view and let response.js do the loading by the >>> form processing. >>> >>> controller: >>> >>> def index(): >>> if form.process().accepted: >>> response.js = '$.web2py.component("%s", target="graph1");' % >>> URL('default', 'graph1.load') >>> >>> index.html: >>> >>> <div id="graph1" style="width: 400px; height: 400px; margin: 0 >>> auto"> >>> </div> >>> >>> Besides this simplifying the case looks that my app does not listen to >>> response.js because just adding the following line does not add the >>> specified HTML tot the div with id location1: >>> >>> response.js = '$.( "#graph1" ).append( "<p>Test</p>" );' >>> >>> >>> Sorry for being inpatient because this question is repeated from this >>> tread >>> https://groups.google.com/forum/#!topic/web2py/nbOpM-0_QvA >>> but this is standard web2py. >>> >>> Thank you for the support. >>> >> -- 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.