True. Another approach is to add getFormSubmittingComponent() to IFormSubmitter interface. But this is definitely only for 7.x.
Did it work with this$0 ? Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Sun, Nov 9, 2014 at 3:52 PM, Maxim Solodovnik <[email protected]> wrote: > one more thing: getComponent() is protected and not accessible :( > > On 9 November 2014 19:27, Maxim Solodovnik <[email protected]> wrote: > > > Done: https://issues.apache.org/jira/browse/WICKET-5753 > > Thanks a lot Martin, will try "to use the special variable "this$0" via > > reflection" > > > > On 9 November 2014 19:14, Martin Grigorov <[email protected]> wrote: > > > >> I don't see a clean way how to accomplish what you need :-/ > >> What I would try is to use the special variable "this$0" via reflection > to > >> get a reference to the AjaxFormSubmitBehavior instance > >> > >> I see a way to simplify this code so it will be possible to do what you > >> need: > >> 1) AjaxFormSubmitBehavior should implement IFormSubmitter > >> 2) onEvent() should do: getForm().getRootForm().onFormSubmitted(this) > >> > >> then you can cast to AbstractAjaxBehavior and call getComponent() and > then > >> cast to IFormSubmittingComponent to get the input name > >> > >> I'm not sure whether clirr-maven-plugin will allow this change in 6.x > >> though > >> > >> Please file a ticket and I'll take a look in the next days. > >> > >> > >> Martin Grigorov > >> Wicket Training and Consulting > >> https://twitter.com/mtgrigorov > >> > >> On Sun, Nov 9, 2014 at 3:01 PM, Maxim Solodovnik <[email protected]> > >> wrote: > >> > >> > Multi-submit button form, and the logic should be in onSubmit method > but > >> > should be different based on button > >> > > >> > On 9 November 2014 19:00, Maxim Solodovnik <[email protected]> > >> wrote: > >> > > >> > > In old code there was logic to perform different actions based on > >> > > inputName :( > >> > > > >> > > > >> > > On 9 November 2014 18:57, Martin Grigorov <[email protected]> > >> wrote: > >> > > > >> > >> Hi, > >> > >> > >> > >> It is an anonymous instance - > >> > >> > >> > >> > >> > > >> > https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java#L159 > >> > >> And there is no way to get an inputName because it is not > associated > >> > >> with IFormSubmittingComponent > >> > >> > >> > >> Why do you need the inputName ? > >> > >> > >> > >> Martin Grigorov > >> > >> Wicket Training and Consulting > >> > >> https://twitter.com/mtgrigorov > >> > >> > >> > >> On Sun, Nov 9, 2014 at 2:52 PM, Maxim Solodovnik < > >> [email protected]> > >> > >> wrote: > >> > >> > >> > >> > unfortunately I'm unable to guess :( > >> > >> > > >> > >> > submittingButton instanceof IFormSubmitter > >> > >> > > >> > >> > I'm out of ideas, this is why i wrote to the list :( > >> > >> > > >> > >> > On 9 November 2014 18:49, Francois Meillet < > >> > [email protected]> > >> > >> > wrote: > >> > >> > > >> > >> > > What instanceof is this submittingButton ? > >> > >> > > > >> > >> > > François Meillet > >> > >> > > Formation Wicket - Développement Wicket > >> > >> > > > >> > >> > > > >> > >> > > > >> > >> > > > >> > >> > > > >> > >> > > Le 9 nov. 2014 à 13:42, Maxim Solodovnik <[email protected] > > > >> a > >> > >> écrit > >> > >> > : > >> > >> > > > >> > >> > > > Thanks for the quick response! > >> > >> > > > > >> > >> > > > Unfortunately this solution is not working due to: > >> > >> > > > submittingButton instanceof > >> > >> > > > org.apache.wicket.markup.html.form.FormComponent == false > >> > >> > > > submittingButton instanceof org.apache.wicket.Component == > >> false > >> > >> > > > submittingButton instanceof submittingButton instanceof > >> > >> > > > org.apache.wicket.behavior.Behavior == false > >> > >> > > > > >> > >> > > > > >> > >> > > > On 9 November 2014 18:37, Francois Meillet < > >> > >> [email protected] > >> > >> > > > >> > >> > > > wrote: > >> > >> > > > > >> > >> > > >> String inputName = ((FormComponent) > >> > >> submittingButton).getInputName(); > >> > >> > > >> > >> > >> > > >> > >> > >> > > >> François Meillet > >> > >> > > >> Formation Wicket - Développement Wicket > >> > >> > > >> > >> > >> > > >> > >> > >> > > >> > >> > >> > > >> > >> > >> > > >> > >> > >> > > >> Le 9 nov. 2014 à 13:08, Maxim Solodovnik < > >> [email protected]> > >> > a > >> > >> > > écrit : > >> > >> > > >> > >> > >> > > >>> Hello All, > >> > >> > > >>> > >> > >> > > >>> I'm trying to migrate project from Wicket 1.4 to Wicket 6. > >> > >> > > >>> > >> > >> > > >>> previously Form.delegateSubmit was Form.delegateSubmit( > >> > >> > > >>> IFormSubmittingComponent > >> > >> > > >>> < > >> > >> > > >> > >> > >> > > > >> > >> > > >> > >> > >> > > >> > http://ci.apache.org/projects/wicket/apidocs/1.4.x/org/apache/wicket/markup/html/form/IFormSubmittingComponent.html > >> > >> > > >>> > >> > >> > > >>> submittingComponent) and the code: > >> > >> > > >>> submittingComponent.getInputName() worked as expected > >> > >> > > >>> right now it is: Form.delegateSubmit(IFormSubmitter > >> > >> submittingButton) > >> > >> > > and > >> > >> > > >>> it is impossible to get inputName anymore :( > >> > >> > > >>> > >> > >> > > >>> I tried to cast submittingComponent to > >> IFormSubmittingComponent > >> > >> but > >> > >> > it > >> > >> > > is > >> > >> > > >>> not working due to submittingComponent is of type > >> > >> > > >>> > >> "org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1@33b88671" > >> > >> and > >> > >> > > I'm > >> > >> > > >>> unable to cast it to something useful :( > >> > >> > > >>> > >> > >> > > >>> Thanks in advance! > >> > >> > > >>> > >> > >> > > >>> -- > >> > >> > > >>> WBR > >> > >> > > >>> Maxim aka solomax > >> > >> > > >> > >> > >> > > >> > >> > >> > > > > >> > >> > > > > >> > >> > > > -- > >> > >> > > > WBR > >> > >> > > > Maxim aka solomax > >> > >> > > > >> > >> > > > >> > >> > > >> > >> > > >> > >> > -- > >> > >> > WBR > >> > >> > Maxim aka solomax > >> > >> > > >> > >> > >> > > > >> > > > >> > > > >> > > -- > >> > > WBR > >> > > Maxim aka solomax > >> > > > >> > > >> > > >> > > >> > -- > >> > WBR > >> > Maxim aka solomax > >> > > >> > > > > > > > > -- > > WBR > > Maxim aka solomax > > > > > > -- > WBR > Maxim aka solomax >
