You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark <ma...@xeric.net> on 2011/07/10 16:28:20 UTC

Select In A Loop

I have a page that allows users to specify a quantity of tickets from
a number of different ticket classes.  So it looks something like
this:

Standard Tickets  [ qty ]
Premium Ticket [ qty ]

When the user types in a qty, select components appear for any options
on the tickets.  So:

Standard Tickets  [ 3 ]
 1.  Seating: [Window]
 2.  Seating: [Aisle]
 3.  Seating: [Window]
Premium Ticket [ 2 ]
 1.  Seating: [Aisle]
 2.  Seating: [Window]

When the user changes a seating option, say from Window to Aisle,
zoneUpdater handles updating the ticket object on the server.  This
works fine because I pass a context telling it which ticket class is
being updated and the index of the ticket (Tickets aren't stored in
the DB until the form is submitted).

However, when I go to submit the form, each submit component tries to
call setTicketOptionOnTicket(TicketOption to).  This obviously doesn't
work because the page doesn't know which ticket needs to be updated.
There doesn't seem to be anyway for me to identify which Ticket needs
updated with the given TicketOption.

I can get around this by setting setTicketOptionOnTicket(TicketOption
to) to do nothing--the ticket options have already been set by Ajax by
the time we submit.  But if Javascript is not present, is there anyway
to tell which select component is being updated without a context?  Is
there a way to tell Tapestry "When you get ready to call
setTicketOptionOnTicket(TicketOption to), make sure you put these
values back to what they were when getTicketOptionOnTicket() was
originally called."?

Thanks for any suggestions.

Mark

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