Hi all,

Forgive me, please, I'm feeling a bit slow and for the life of me am
struggling with what I think should be a trivial concept...

Please consider this simple example...

Let's say there's a list of products, and one wants to loop over those
products, displaying them as line items in a form in which the user can
change the quantity or remove the items (typical shopping cart
functionality)... something like this:


<form t:id="online">
  <t:loop source="onlineItems" value="lineItem" encoder="itemEncoder">
    <t:actionlink context="lineItem.id">Remove</t:actionlink>
    <input type="text" size="1" id="switch1" class="small qtySmall"
      t:type="textfield" t:value="itemQuantity"/>
    <t:linksubmit>Update Price</t:linksubmit>
  </t:loop>
</form>


There's two concerns here that seem connected in concept:

1) It appears that for this form the only way to handle the actionlink
action is to use the catch all 'onAction(String id)'  which works for this
case just fine, but prevents me from having another action for some other
purpose...  is there no way to identify the event handler in such a way as
to be tied to the 'remove' concept?  Like, onActionFromRemove(String id),
but how does one create this handler for a dynamically identified component,
such as the (many) action links created in the loop?

2) The quantity of the line item is reflected in a text field which the user
can change.  To update the total price, the form must be submitted so the
values of the text fields can be known.  However, to interpret this
submission differently than, say, the actual checkout submission one has to
capture the 'selected' event and set some property appropriately, such that
the onSuccess handler can act accordingly.  Again, the only way seems to be
to use the catch all 'onSelected' handler, and not a specific handler for
this particular type of selected event.

Thanks,

Levi
-- 
View this message in context: 
http://n2.nabble.com/T5-1-Loops-Forms-and-Events-tp3618845p3618845.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to