thanks alan, for your pointer. btw, i've use above way to modify session
value, yet in the screen (html) it's update but when i refresh (f5), the
session value is remain the same.
e.g.
*controllers*
def purchase_return_checkout():
if not session.purchase_return_header:
redirect(URL('purchase_return_form') )
rows = db(db.purchase_order_detail.purchase_order_no ==
session.purchase_return_header['purchase_order_no']).select()
session.purchase_return_detail = rows.as_list()
return dict(session_purchase_return_header =
session.purchase_return_header,
session_purchase_return_detail = session.purchase_return_detail)
def purchase_return_callback():
if request.vars.action == 'subtract':
i = int(request.vars.i)
qty = int(session.purchase_return_detail[i]['quantity'])
session.purchase_return_detail[i]['quantity'] = max(0, qty - 1)
return str(session.purchase_return_detail[i]['quantity'])
if request.vars.action == 'remove':
i = int(request.vars.i)
del session.purchase_return_detail[i:]
redirect(URL('purchase_return_checkout') )
*views*
{{for i, row in enumerate(session_purchase_return_detail):}}
<tr>
<td>
{{=SPAN(session_purchase_return_detail[i]['quantity'], _id="item_%s" % i) }}
</td>
<td>
{{=SPAN(A(I(_class = 'icon-minus-sign'), _title='Substract Quantity',
target='item_%s' % i,
callback=URL('purchase_return_callback', vars=dict(i=i, action='subtract')
) ) ) }}
{{=SPAN(A(I(_class='icon-remove-sign'),
callback=URL('purchase_return_callback', vars=dict(i=i, action='remove') ),
delete='tr', _title='Remove %s from purchase Return' % p.name) ) }}
</td>
</tr>
{{pass}}
yes, i've doing wrong in that part too, my intention is to clear the
session after i insert to the tables. at first, i think it's dictionary so
that i use clear() method.
best regards,
stifan
--
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/groups/opt_out.