You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Antoine Angenieux <aa...@clinigrid.com> on 2013/08/07 09:44:20 UTC
Problem with Ajax submit link in multipartform with dynamic extra
parameters
Hi all!
I'm using Wicket 6 (both 6.8 and 6.9.1) and am facing an issue when:
1. I have a multipart form
2. This form is submitted via an AjaxSubmitLink (or by any component
using an Ajax behavior for submission)
3. The updateAjaxAttributes method of the link is overridden to:
3.1 set multipart to true on the attributes
3.2 add dynamic extra parameters to the attributes
then, the dynamic extra parameters are not evaluated.
I have come up with a quickstart based on Wicket 6.9.1 if you are
interested, otherwise, below is code from the quickstart that displays
the issue:
public HomePage(final PageParameters parameters) {
super(parameters);
final Form<Void> form;
add(form = new Form<Void>("form"));
form.setMultiPart(true);
form.add(new AjaxSubmitLink("submit") {
private static final long serialVersionUID = 1L;
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setMultipart(true);
attributes.getDynamicExtraParameters().add(
"return { 'param1': 0 }");
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
assertEquals("1", getRequest().getRequestParameters()
.getParameterValue("param1").toOptionalString());
}
});
}
When clicking the link, the assertion always fails. If I comment both
form.setMultipart(true) and attributes.setMultipart(true), then the
assertion is true, as expected.
Do you have any idea? Or should I fill a ticket with the attached
quickstart?
Thanks in advance for your answsers!
Cheers,
Antoine.
--
-------------
Antoine Angénieux
Co-founder
mob: +33 6 60 21 09 18
aangenieux@clinigrid.com
-------------
Clinigrid
92/98 boulevard Victor Hugo
93300 Clichy Cedex
Tel: +33 1 55 90 66 84
-------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with Ajax submit link in multipartform with dynamic extra
parameters
Posted by Antoine Angenieux <aa...@clinigrid.com>.
Hi Martin,
Thanks for this quick answer, as usual!
Here is the link to the issue, with its attached quickstart:
https://issues.apache.org/jira/browse/WICKET-5306
Cheers,
Antoine.
-------------
Antoine Angénieux
Co-founder
mob: +33 6 60 21 09 18
aangenieux@clinigrid.com
-------------
Clinigrid
92/98 boulevard Victor Hugo
93300 Clichy Cedex
Tel: +33 1 55 90 66 84
-------------
Le 07/08/2013 09:47, Martin Grigorov a écrit :
> Hi,
>
> Please create a ticket and attach the quickstart.
> It is a bug.
>
>
> On Wed, Aug 7, 2013 at 9:44 AM, Antoine Angenieux
> <aa...@clinigrid.com>wrote:
>
>> Hi all!
>>
>> I'm using Wicket 6 (both 6.8 and 6.9.1) and am facing an issue when:
>>
>> 1. I have a multipart form
>> 2. This form is submitted via an AjaxSubmitLink (or by any component using
>> an Ajax behavior for submission)
>> 3. The updateAjaxAttributes method of the link is overridden to:
>> 3.1 set multipart to true on the attributes
>> 3.2 add dynamic extra parameters to the attributes
>>
>> then, the dynamic extra parameters are not evaluated.
>>
>> I have come up with a quickstart based on Wicket 6.9.1 if you are
>> interested, otherwise, below is code from the quickstart that displays the
>> issue:
>>
>> public HomePage(final PageParameters parameters) {
>> super(parameters);
>> final Form<Void> form;
>> add(form = new Form<Void>("form"));
>> form.setMultiPart(true);
>> form.add(new AjaxSubmitLink("submit") {
>>
>> private static final long serialVersionUID = 1L;
>>
>> @Override
>> protected void updateAjaxAttributes(**AjaxRequestAttributes
>> attributes) {
>> super.updateAjaxAttributes(**attributes);
>> attributes.setMultipart(true);
>> attributes.**getDynamicExtraParameters().**add(
>> "return { 'param1': 0 }");
>> }
>>
>> @Override
>> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>> assertEquals("1", getRequest().**getRequestParameters()
>> .getParameterValue("param1").**toOptionalString());
>> }
>>
>>
>> });
>>
>> }
>>
>> When clicking the link, the assertion always fails. If I comment both
>> form.setMultipart(true) and attributes.setMultipart(true), then the
>> assertion is true, as expected.
>>
>> Do you have any idea? Or should I fill a ticket with the attached
>> quickstart?
>>
>> Thanks in advance for your answsers!
>>
>> Cheers,
>>
>> Antoine.
>>
>> --
>> -------------
>> Antoine Angénieux
>> Co-founder
>> mob: +33 6 60 21 09 18
>> aangenieux@clinigrid.com
>> -------------
>> Clinigrid
>> 92/98 boulevard Victor Hugo
>> 93300 Clichy Cedex
>> Tel: +33 1 55 90 66 84
>> -------------
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problem with Ajax submit link in multipartform with dynamic extra parameters
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
Please create a ticket and attach the quickstart.
It is a bug.
On Wed, Aug 7, 2013 at 9:44 AM, Antoine Angenieux
<aa...@clinigrid.com>wrote:
> Hi all!
>
> I'm using Wicket 6 (both 6.8 and 6.9.1) and am facing an issue when:
>
> 1. I have a multipart form
> 2. This form is submitted via an AjaxSubmitLink (or by any component using
> an Ajax behavior for submission)
> 3. The updateAjaxAttributes method of the link is overridden to:
> 3.1 set multipart to true on the attributes
> 3.2 add dynamic extra parameters to the attributes
>
> then, the dynamic extra parameters are not evaluated.
>
> I have come up with a quickstart based on Wicket 6.9.1 if you are
> interested, otherwise, below is code from the quickstart that displays the
> issue:
>
> public HomePage(final PageParameters parameters) {
> super(parameters);
> final Form<Void> form;
> add(form = new Form<Void>("form"));
> form.setMultiPart(true);
> form.add(new AjaxSubmitLink("submit") {
>
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void updateAjaxAttributes(**AjaxRequestAttributes
> attributes) {
> super.updateAjaxAttributes(**attributes);
> attributes.setMultipart(true);
> attributes.**getDynamicExtraParameters().**add(
> "return { 'param1': 0 }");
> }
>
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
> assertEquals("1", getRequest().**getRequestParameters()
> .getParameterValue("param1").**toOptionalString());
> }
>
>
> });
>
> }
>
> When clicking the link, the assertion always fails. If I comment both
> form.setMultipart(true) and attributes.setMultipart(true), then the
> assertion is true, as expected.
>
> Do you have any idea? Or should I fill a ticket with the attached
> quickstart?
>
> Thanks in advance for your answsers!
>
> Cheers,
>
> Antoine.
>
> --
> -------------
> Antoine Angénieux
> Co-founder
> mob: +33 6 60 21 09 18
> aangenieux@clinigrid.com
> -------------
> Clinigrid
> 92/98 boulevard Victor Hugo
> 93300 Clichy Cedex
> Tel: +33 1 55 90 66 84
> -------------
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>