Hi Ben, a really basic example. I'm assuming your trying to loop the zones, I hope this helps.
<t:Loop source="products" value="product"> ${product} <t:select t:id="cardType" validate="required" zone="${product}"/> <t:zone t:id="cardTypeZone" id="${product}"> <t:if test="cardTypes"> <p> ${cardTypes}</p> <t:if> <t:zone> <t:Loop> @Property private CardType cardType; @Property private String cardTypes; @InjectComponent private Zone cardTypeZone; private String products = "desk,computer"; @Property private String _product; public String[] getProducts() { return products.split(","); } public Object onValueChanged(CardType cardType) { cardTypes = findCardType(cardType); return cardTypeZone.getBody(); } public String findCardType(final CardType cardType) { switch (cardType) { case DISCOVER: return "Discover Card"; case VISA: return "Visa"; case MASTERCARD: return "Mastercard"; default: return "American Express"; } } public enum CardType { DISCOVER, VISA, MASTERCARD, AMEX; } On Tue, Apr 23, 2013 at 3:27 PM, Jens Breitenstein <mailingl...@j-b-s.de>wrote: > Hi Ben! > > I am using the tapestry-jquery mixin for this: > > tml: > > <t:select t:id="yourId" model="yourModel" encoder="yourEncoder" > t:validate="required" value="yourValue" > t:mixins="jquery/bind" bind.context="${yourValue.pk}" bind.event=" > **yourSelectionChanged" bind.eventType="change"/> > > page: > > public Object onYourSelectionChanged(final long pk) > { > System.out.println(pk); > return null; > } > > > > so any change of the select input control triggers "change" which calls > the "yourSelectionChanged" method, which is named "onYourSelectionChanged" > in java by tapestry convention. I believe you can use "[${yourValue.pk}, > ${whateverId}] to pass multiple arguments to your method, too (be careful: > this is just my gut feeling, never tried it) > > Jens > > > > Am 23.04.13 17:58, schrieb Ben Titmarsh: > > After a lot of Googling around I'm unable to find a solution to my >> problem. I want to handle the change event from a Select Component. I'm >> creating a bunch of these components in a loop: >> >> <t:select t:id="type" model="cardTypeModel" encoder="cardTypeEncoder" >> value="cubeCard.cardType" blankOption="never"/> >> >> And I've got the following handler declaration: >> >> @OnEvent(component="type", value = "change") >> public Object onChangeOfCardType(String value) { >> System.out.println("onChange!!**!"); >> return cardTypeZone.getBody(); >> } >> Ideally I want to provide some context to this handler too so that >> it knows which CardType to update (i.e. which Select the event came from). >> The handler just isn't getting called at the moment, what am I doing wrong? >> >> > > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- George Christman www.CarDaddy.com P.O. Box 735 Johnstown, New York