You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Pouyan Zaxar <pa...@quaintous.com> on 2012/08/14 12:37:10 UTC

Multi-part content in nested forms (Wicket 6.0)

Hi all,

I have been experiencing some problems with nested forms lately. I have
an outer form which contains a FileUploadFile and an inner form with no
upload field. If I submit the inner form in *AJAX* mode, I get the
following error:

Last cause: ServletRequest does not contain multipart content. One
possible solution is to explicitly call Form.setMultipart(true), Wicket
tries its best to auto-detect multipart forms but there are certain
situation where it cannot.

even though the outer form has its setMultiPart(true).
Adding setMultiPart(true) to the inner form (even though it makes no
sense at all) breaks the JavaScript:

ERROR: Wicket.Ajax.Call.submitForm: Trying to submit form with id
'undefined' that is not in document.

even though its setOutputMarkupID(true) is set.

I have also tried the following

public boolean wantSubmitOnNestedFormSubmit() {
        return false;
}

on the outer form, but I had no luck at all.

I would really appreciate if you could help me with this.
Best
Pouyan

Re: Multi-part content in nested forms (Wicket 6.0)

Posted by Pouyan Zaxar <pa...@quaintous.com>.
Update:

the problem is solved if you add the outer form to the
AjaxFallbackButton of inner from, so instead of
 
new AjaxFallbackButton("innerSubmit",innerForm)

you should do

new AjaxFallbackButton("innerSubmit",outerForm)

Sorry for the fuss.
Best
Pouyan

On Tue, 2012-08-14 at 14:43 +0200, Pouyan Zaxar wrote:
> Update:
> 
> Considering following cases:
> 
> 1) Outer form has its multipart set to true and inner form to false:
> when inner form is submitted, a GET AJAX request is sent to server. The
> outer list however is a multipart one and expects a post request (see
> L#64 ServletFileUpload), thus the exception is thrown.
> 
> 2) Both forms has their setMultipart to true:
> when the inner form is submitted via AJAX, since it is a multipart form,
> a new iframe (containing a submit button) is created and the JavaScript
> function submit() is called on the inner form. On the other side, since
> the inner form is just a div and no real form, the function fails.
> 
> up to now, I haven't come up with a solution, which adequately addresses
> this problem. I also didn't want to make any changes to JS files.
> 
> Best,
> Pouyan
> On Tue, 2012-08-14 at 12:37 +0200, Pouyan Zaxar wrote:
> > Hi all,
> > 
> > I have been experiencing some problems with nested forms lately. I have
> > an outer form which contains a FileUploadFile and an inner form with no
> > upload field. If I submit the inner form in *AJAX* mode, I get the
> > following error:
> > 
> > Last cause: ServletRequest does not contain multipart content. One
> > possible solution is to explicitly call Form.setMultipart(true), Wicket
> > tries its best to auto-detect multipart forms but there are certain
> > situation where it cannot.
> > 
> > even though the outer form has its setMultiPart(true).
> > Adding setMultiPart(true) to the inner form (even though it makes no
> > sense at all) breaks the JavaScript:
> > 
> > ERROR: Wicket.Ajax.Call.submitForm: Trying to submit form with id
> > 'undefined' that is not in document.
> > 
> > even though its setOutputMarkupID(true) is set.
> > 
> > I have also tried the following
> > 
> > public boolean wantSubmitOnNestedFormSubmit() {
> >         return false;
> > }
> > 
> > on the outer form, but I had no luck at all.
> > 
> > I would really appreciate if you could help me with this.
> > Best
> > Pouyan
> 


Re: Multi-part content in nested forms (Wicket 6.0)

Posted by Pouyan Zaxar <pa...@quaintous.com>.
Update:

Considering following cases:

1) Outer form has its multipart set to true and inner form to false:
when inner form is submitted, a GET AJAX request is sent to server. The
outer list however is a multipart one and expects a post request (see
L#64 ServletFileUpload), thus the exception is thrown.

2) Both forms has their setMultipart to true:
when the inner form is submitted via AJAX, since it is a multipart form,
a new iframe (containing a submit button) is created and the JavaScript
function submit() is called on the inner form. On the other side, since
the inner form is just a div and no real form, the function fails.

up to now, I haven't come up with a solution, which adequately addresses
this problem. I also didn't want to make any changes to JS files.

Best,
Pouyan
On Tue, 2012-08-14 at 12:37 +0200, Pouyan Zaxar wrote:
> Hi all,
> 
> I have been experiencing some problems with nested forms lately. I have
> an outer form which contains a FileUploadFile and an inner form with no
> upload field. If I submit the inner form in *AJAX* mode, I get the
> following error:
> 
> Last cause: ServletRequest does not contain multipart content. One
> possible solution is to explicitly call Form.setMultipart(true), Wicket
> tries its best to auto-detect multipart forms but there are certain
> situation where it cannot.
> 
> even though the outer form has its setMultiPart(true).
> Adding setMultiPart(true) to the inner form (even though it makes no
> sense at all) breaks the JavaScript:
> 
> ERROR: Wicket.Ajax.Call.submitForm: Trying to submit form with id
> 'undefined' that is not in document.
> 
> even though its setOutputMarkupID(true) is set.
> 
> I have also tried the following
> 
> public boolean wantSubmitOnNestedFormSubmit() {
>         return false;
> }
> 
> on the outer form, but I had no luck at all.
> 
> I would really appreciate if you could help me with this.
> Best
> Pouyan