Yes, the onSelectedXXX works! Thank you. The annotaded way won't work. I've tried it. Maybe this is a bug. I am using Tapestry 5.0.18.
2009/2/27 nille hammer <tapestry.nilleham...@winfonet.eu>: > Hi Dante, > the convention for naming of handle methods of submit events is > "onSelectedFrom<id>". Rewrite your code as follows and it shuld work. The > annotaded way should work too, although I have never used it myself. > > public class Start{ > void onSelectedFromBtnA(){ > // this should work > } > > void onSelectedFromBtnB(){ > //this should work > } > See documentation of the Submit component for further details: > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html > > Kind Regards, nillehammer > > -- > http://www.winfonet.eu > > ----- original Nachricht -------- > > Betreff: More than one submit button in one form. > Gesendet: Fr, 27. Feb 2009 > Von: ËïÁ¢Î°<dante....@gmail.com> > >> While I am reading the book "Tapestry 5: Building Web Applications", >> it introduces a way to implements two submit button in one form(see >> the code below). But according to >> http://markmail.org/message/fjev6gt76fpc6akq , all buttons' events >> will be "overrided" by the form component. Is there a way to detect >> which button is clicked? >> >> For example, how to let the following code work? >> >> Start.tml: >> >> <t:form t:id="mainForm"> >> <input type="submit" t:type="submit" t:id="btnA"/> >> <input type="submit" t:type="submit" t:id="btnB"/> >> </t:form> >> >> >> Start.java >> public class Start{ >> @OnEvent(component="btnA") >> void onBtnAClick(){ >> // this won't work >> } >> >> @OnEvent(component="btnB") >> void onBtnBClick(){ >> //this won't work >> } >> >> @OnEvent(component="mainForm") >> Object onFormSubmit(){ >> //only this works >> } >> } >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > --- original Nachricht Ende ---- > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org