No, you cannot have two targets (even if you could, your attempted syntax 
of providing two "target" keywords in a single function call would be 
illegal in Python). However, you can specify ":eval" as the target, in 
which case the callback function can return Javascript code that does 
whatever you want, including putting some returned value into multiple 
target divs. See http://web2py.com/books/default/chapter/29/11#Eval-target.

Anthony

On Wednesday, February 20, 2013 10:02:40 AM UTC-5, 黄祥 wrote:
>
> hi, 
>
> is it possible for callback target in two places?
>
> *e.g. 1. not work*
> <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>{{=SPAN(qty, _id='item_%s' % p.id)}}</td>
>         <td>{{=SPAN(qty*p.unit_price, _id='total_%s' % p.id)}}</td>
>         <td>{{=SPAN(A('Add', callback=URL('order_callback', vars=dict(id=
> p.id, action='add')), *target='item_%s' % p.id, target='total_%s' % p.id*, 
> _title='Add Quantity', _class='btn btn-navbar'))}}</td>
>     </tr>
> {{pass}}
> </table>
>
> *e.g. 2. not work*
> <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>{{=SPAN(qty, *_id='item_%s' % p.id*)}}</td>
>         <td>{{=SPAN(qty*p.unit_price, *_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'))}}</td>
>     </tr>
> {{pass}}
> </table>
>
> *e.g. 3. not work*
> <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>{{=SPAN(qty, *_class='item_%s' % p.id*)}}</td>
>         <td>{{=SPAN(qty*p.unit_price, *_class='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'))}}</td>
>     </tr>
> {{pass}}
> </table>
>
> i've tried it and an error occured. is it possible for callback target in 
> two places?
>
> thank you very much
>

-- 

--- 
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.


Reply via email to