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





Reply via email to