You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Sven Meier <sv...@meiers.net> on 2013/01/29 23:37:48 UTC
AjaxRequestAttributes#setSubmittingComponentName()
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
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Sven Meier <sv...@meiers.net>.
Well, that's exactly what is failing in my tests currently:
public boolean processChildren() {
IFormSubmitter submitter = this.getFormSubmitter(); //!\\
return submitter != null && submitter.getForm() == this;
}
If this is the way to control submit to nested forms, we'll have to make
sure this works in tests too.
Sven
On 01/30/2013 12:16 PM, Martin Grigorov wrote:
> 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 <sv...@meiers.net> 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 <sv...@meiers.net> 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 <sv...@meiers.net> 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 <sv...@meiers.net> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Martin Grigorov <mg...@apache.org>.
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 <sv...@meiers.net> 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 <sv...@meiers.net> 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 <sv...@meiers.net> 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 <sv...@meiers.net> 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/>
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Sven Meier <sv...@meiers.net>.
>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 <sv...@meiers.net> 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 <sv...@meiers.net> 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 <sv...@meiers.net> 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
>>>>>>
>>>>>>
>>>>>>
>
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Martin Grigorov <mg...@apache.org>.
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 <sv...@meiers.net> 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 <sv...@meiers.net> 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 <sv...@meiers.net> 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/>
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Sven Meier <sv...@meiers.net>.
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 <sv...@meiers.net> 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 <sv...@meiers.net> 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
>>>>
>>>>
>>>
>
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Martin Grigorov <mg...@apache.org>.
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 <sv...@meiers.net> 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 <sv...@meiers.net> 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/>
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Sven Meier <sv...@meiers.net>.
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 <sv...@meiers.net> 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
>>
>
>
Re: AjaxRequestAttributes#setSubmittingComponentName()
Posted by Martin Grigorov <mg...@apache.org>.
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 <sv...@meiers.net> 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/>