Recently Sebastien (the author of wicket-jquery-ui) needed to set the submitting component from the client side (JS API). He asked about wicketSubmitFormById(), i.e. Wicket 1.5 API but I guess he will need the same in Wicket 6. http://markmail.org/thread/2onx3qrq5l3vrsyc
Without the info what is the submitting button you wont be able to decide whether an outer or nested form is submitted. On Wed, Jan 30, 2013 at 12:04 PM, Sven Meier <[email protected]> wrote: > >it will always see AFSB's anonymous IFormSubmitter as submitter > > Yes. > > > > and wont ever know that AjaxSubmitLink is the real submitter behind > > I'm not sure why anybody should be interested in this detail: > If an AjaxFallbackButton is triggered via Ajax, who is the submitter, the > button or the behavior? > IMHO it's the behavior. > > > >I think this is the broken code > > I think we should just remove/deprecate ARA#submittingComponentName ... it > works fine without it. > > Sven > > > > On 01/30/2013 10:31 AM, Martin Grigorov wrote: > >> I see what happens. >> >> In Form#onFormSubmitted there is: >> >> if (submitter == null) >> { >> submitter = findSubmittingButton(); >> } >> >> i.e. it will always see AFSB's anonymous IFormSubmitter as submitter and >> wont ever know that AjaxSubmitLink is the real submitter behind. >> >> I think this is the broken code. >> I'm not sure how important is to know that a link is the actual submitter >> though. AFSB's anonymous IFormSubmitter will delegate to the link anyway. >> >> On Wed, Jan 30, 2013 at 10:13 AM, Sven Meier <[email protected]> wrote: >> >> The AFSB knows that it is triggered, because it is directly triggered as >>> a >>> behavior listener. >>> For that it doesn't need the extra parameter. >>> >>> My concern is that Form#findSubmittingButton() is inconsistent between >>> runtime and tests. >>> Before digging into WicketTester I'd rather remove that paramter in ARA. >>> >>> Sven >>> >>> >>> >>> On 01/30/2013 09:27 AM, Martin Grigorov wrote: >>> >>> It is used indirectly by AjaxSubmitLink and AjaxButton, for example. >>>> They use AFSB. After submit the form (and the client code) know that a >>>> link/button actually submitted the form. >>>> >>>> Or maybe I don't understand your concern. >>>> >>>> >>>> On Wed, Jan 30, 2013 at 9:19 AM, Sven Meier <[email protected]> wrote: >>>> >>>> I know, but for what is that needed? >>>> >>>>> Sven >>>>> >>>>> >>>>> On 01/30/2013 09:09 AM, Martin Grigorov wrote: >>>>> >>>>> Hi Sven, >>>>> >>>>>> AFSB sets it only if : >>>>>> >>>>>> if (getComponent() instanceof IFormSubmittingComponent) >>>>>> { >>>>>> String submittingComponentName = >>>>>> ((IFormSubmittingComponent)******getComponent()).getInputName(** >>>>>> )****; >>>>>> attributes.******setSubmittingComponentName(****** >>>>>> >>>>>> submittingComponentName); >>>>>> >>>>>> } >>>>>> >>>>>> i.e. if it is attached to a submitting component like a button. >>>>>> >>>>>> It is the same in 1.5 >>>>>> (org.apache.wicket.ajax.form.******AjaxFormSubmitBehavior#**** >>>>>> >>>>>> getEventHandler): >>>>>> >>>>>> >>>>>> if (getComponent() instanceof IFormSubmittingComponent) >>>>>> { >>>>>> call.append("'") >>>>>> .append(((******IFormSubmittingComponent)**** >>>>>> getComponent()).getInputName()***** >>>>>> >>>>>> >>>>>> *) >>>>>> .append("' "); >>>>>> } >>>>>> >>>>>> >>>>>> >>>>>> On Tue, Jan 29, 2013 at 11:37 PM, Sven Meier <[email protected]> wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> can somebody explain what AjaxRequestAttributes#**** >>>>>>> setSubmittingComponentName() >>>>>>> is for? >>>>>>> It is set by AjaxFormSubmitBehavior#********updateAjaxAttributes() >>>>>>> only. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Why I'm asking? >>>>>>> When a form is submitted by an AjaxFormSubmitBehavior, we have an >>>>>>> inconsistency between WicketTester and a real submit from the >>>>>>> browser: >>>>>>> In the former case Form#findSubmittingButton() returns null, in the >>>>>>> latter >>>>>>> case it returns the Button the AjaxFormSubmitBehavior is bound to. >>>>>>> >>>>>>> It seems that #setSubmittingComponentName() is superfluous because >>>>>>> the >>>>>>> AjaxFormSubmitBehavior will be triggered as the form submitter >>>>>>> anyway. >>>>>>> Strictly speaking the button is *not* the form submitter but the >>>>>>> behavior >>>>>>> is, so it makes sense that #findSubmittingButton() should return >>>>>>> null. >>>>>>> >>>>>>> Any thoughts? >>>>>>> >>>>>>> Sven >>>>>>> >>>>>>> >>>>>>> >>>>>>> >> > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
