Anthony,
After solving some other issues, I continue with this challenge.
Also in an other (I think similar) case the form acceptance does not work
like I expect.
In the controller:
persons = db(db.sales).select(db.sales.person,
distinct=True).as_list()
sales_months = db(db.sales).select(db.sales.sales_month,
distinct=True).as_list()
prods = db(db.sales).select(db.sales.prod,
distinct=True).as_list()
form1=FORM(TABLE( TR('Person:', SELECT(_name='person',
*[OPTION(persons[i]['person'], _value =
persons[i]['person']) for i in range(len(persons)) ] ) ),
TR('Month:', SELECT(_name='sales_month',
*[OPTION(sales_months[i]['sales_month'], _value =
sales_months[i]['sales_month']) for i in range(len(sales_months)) ] ) ),
TR('prod:', SELECT(_name='prod',
*[OPTION(prods[i]['prod'], _value = prods[i]['prod']) for i in
range(len(prods)) ] ) ),
INPUT(_type='submit')))
if form1.process(formname='form_one').accepted:
response.js= '$web2py.component("%s", target="graph1");' %
URL('default', 'graph1.load')
In the view index.html:
<div id="graph1" style="width: 400px; height: 400px; margin: 0 auto">
</div>
view graph1.load:
<script>
$(document).ready( function () {
$('#graph1').highcharts({
chart: {
type: 'column'
..... etc
putting {{=response}} in the view does not give me the
*"web2py-component-command"
header with that JS code*
Searching int response on "component" it only gives :
.... 'session_id_name': 'session_id_hc4a', 'js':
'$web2py.component("/hc4a/default/graph1.load", target="graph1");',
'google_ ....
*What is missing?*
On Thursday, July 3, 2014 2:54:45 PM UTC+2, Anthony wrote:
>
> On Thursday, July 3, 2014 7:56:39 AM UTC-4, Richard wrote:
>>
>> 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>
>>
>
> Note, "ajax" is not an argument of A(), so will be ignored.
>
>
>> I assume this link is equal to {{=LOAD('internal','add_entity.load',
>> vars=dict(com=com, sif=sif)), ajax=True, cid='internal_data_div') }}
>>
>
> Note, "cid" is not an argument of LOAD(), so will be ignored, and instead,
> a random target id will be created as the cid.
>
>
>> 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')
>>
>
> Can you confirm that the form is being processed and accepted? Does the
> returned Ajax response include a "web2py-component-command" header with
> that JS code?
>
> Anthony
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.