The process involves multiple steps -- activity on the server, followed by Javascript updates in the UI. If the UI doesn't update as expected, there is no reason to believe the problem must be with the code on the server -- the problem may be with the Javascript. I believe your code is updating the session properly, but you are then not communicating that change in the session back to the browser. You might want to start more simply (i.e., avoid all the Ajax callbacks), get something more basic working, and then figure out how to enhance it with Ajax/Javascript.
Anthony On Wednesday, February 20, 2013 10:37:36 AM UTC-5, 黄祥 wrote: > > no error occured, i'm expected to update the quantity value through form > fields that user enter. nothing change, even after i refresh the page (F5), > the value in quantity form field and in span is not update. i'm not sure > what is running when i'm update the quantity form field and then press TAB. > do you have any conclusion about this? and how i trace it what is going > happen in the background of the process function? > > here is the code : > *#controller : default.py* > def order_update(): > id=int(request.vars.id) > qty=int(request.vars.qty) > # session.order.get(id, 0)=qty > session.order[id]=qty > return locals() > > *#view : order.html* > <table width="100%"> > {{for id, qty in order.items():}} > {{p=db.product(id)}} > <tr> > <td>{{=SPAN(p.product_name)}}</td> > <td>{{=SPAN('Rp. %s' % p.unit_price)}}</td> > * <td><form><input id="{{='qty_%s' % p.id}}" name="quantity" > value="{{=qty}}" onkeyup="ajax('order_update, vars=dict(id={{=p.id}}, > qty={{=qty}})', ['quantity'], '{{='qty_%s' % p.id}}')"></form></td>* > <td>{{=SPAN(qty, _id='item_%s' % p.id)}}</td> > <td>{{=SPAN(A('Add', callback=URL('order_callback', vars=dict(id= > p.id, action='add')), target='item_%s' % p.id, _title='Add Quantity', > _class='btn btn-navbar'))}} {{=SPAN(A('Subtract', > callback=URL('order_callback', vars=dict(id=p.id, action='subtract')), > target='item_%s' % p.id, _title='Substract Quantity', _class='btn > btn-navbar'))}} {{=SPAN(A('Remove', callback=URL('order_callback', > vars=dict(id=p.id, action='remove')), delete='tr', _title='Remove %s from > Order' % p.product_name, _class='btn btn-navbar'))}}</td> > </tr> > {{pass}} > </table> > -- --- 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/groups/opt_out.