You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mscoon <ms...@gmail.com> on 2015/02/10 15:36:58 UTC

Ajax submit form with FileUploadField

Hi all,

We are seeing strange behavior in a form that contains a FileUploadField
when submitted with an AjaxSubmitLink. What happens is:
1. The form is embedded in another form, so wicket renders it as a div
2. The form is removed from it's parent element and placed within a JQuery
dialog
3. The outher form contains a FileUploadField

When the inner form is submitted we get the following error in the ajax
debug panel:
"Cannot submit form with id criteria69 because there is no form
element in the hierarchy."

Removing the FileUploadField makes the error disappear, even though there
is no form element in the hierarchy due to step (2) above.

Any ideas why this is happening?

Thanks
Marios

Re: Ajax submit form with FileUploadField

Posted by Martin Grigorov <mg...@apache.org>.
with or without file field Wicket submits all fields
and on the server side by using the submitter button decides which form to
process
On Feb 12, 2015 8:00 PM, "mscoon" <ms...@gmail.com> wrote:

> Thank you for your answer.
>
> One more thing. Since I am trying to submit an inner form (which has been
> rendered as a div) and which does not contain a FileUploadField, why would
> wicket use an IFrame? Is the decision being made based on the outer form
> for all ajax submit links?
>
> On Thu, Feb 12, 2015 at 11:41 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > Yes, it does.
> > When there is a file input in the form Wicket needs to use an IFrame to
> be
> > able to send the binary data because XmlHttpRequest v1 (IE 8/9/10 I
> think)
> > doesn't support sending binary.
> > The related code is at
> >
> >
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L623
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Thu, Feb 12, 2015 at 11:36 PM, mscoon <ms...@gmail.com> wrote:
> >
> > > Since no-one has responded, let me try to rephrase the question: is
> > wicket
> > > doing something different when submitting a form via ajx without and
> > with a
> > > FileUploadField? If yes, could you please give me some pointers in the
> > code
> > > to look at?
> > >
> > > Thanks
> > > Marios
> > >
> > > On Tue, Feb 10, 2015 at 4:36 PM, mscoon <ms...@gmail.com> wrote:
> > >
> > > > Hi all,
> > > >
> > > > We are seeing strange behavior in a form that contains a
> > FileUploadField
> > > > when submitted with an AjaxSubmitLink. What happens is:
> > > > 1. The form is embedded in another form, so wicket renders it as a
> div
> > > > 2. The form is removed from it's parent element and placed within a
> > > JQuery
> > > > dialog
> > > > 3. The outher form contains a FileUploadField
> > > >
> > > > When the inner form is submitted we get the following error in the
> ajax
> > > > debug panel:
> > > > "Cannot submit form with id criteria69 because there is no form
> element
> > > in the hierarchy."
> > > >
> > > > Removing the FileUploadField makes the error disappear, even though
> > there
> > > > is no form element in the hierarchy due to step (2) above.
> > > >
> > > > Any ideas why this is happening?
> > > >
> > > > Thanks
> > > > Marios
> > > >
> > >
> >
>

Re: Ajax submit form with FileUploadField

Posted by mscoon <ms...@gmail.com>.
Thank you for your answer.

One more thing. Since I am trying to submit an inner form (which has been
rendered as a div) and which does not contain a FileUploadField, why would
wicket use an IFrame? Is the decision being made based on the outer form
for all ajax submit links?

On Thu, Feb 12, 2015 at 11:41 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> Yes, it does.
> When there is a file input in the form Wicket needs to use an IFrame to be
> able to send the binary data because XmlHttpRequest v1 (IE 8/9/10 I think)
> doesn't support sending binary.
> The related code is at
>
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L623
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Feb 12, 2015 at 11:36 PM, mscoon <ms...@gmail.com> wrote:
>
> > Since no-one has responded, let me try to rephrase the question: is
> wicket
> > doing something different when submitting a form via ajx without and
> with a
> > FileUploadField? If yes, could you please give me some pointers in the
> code
> > to look at?
> >
> > Thanks
> > Marios
> >
> > On Tue, Feb 10, 2015 at 4:36 PM, mscoon <ms...@gmail.com> wrote:
> >
> > > Hi all,
> > >
> > > We are seeing strange behavior in a form that contains a
> FileUploadField
> > > when submitted with an AjaxSubmitLink. What happens is:
> > > 1. The form is embedded in another form, so wicket renders it as a div
> > > 2. The form is removed from it's parent element and placed within a
> > JQuery
> > > dialog
> > > 3. The outher form contains a FileUploadField
> > >
> > > When the inner form is submitted we get the following error in the ajax
> > > debug panel:
> > > "Cannot submit form with id criteria69 because there is no form element
> > in the hierarchy."
> > >
> > > Removing the FileUploadField makes the error disappear, even though
> there
> > > is no form element in the hierarchy due to step (2) above.
> > >
> > > Any ideas why this is happening?
> > >
> > > Thanks
> > > Marios
> > >
> >
>

Re: Ajax submit form with FileUploadField

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Yes, it does.
When there is a file input in the form Wicket needs to use an IFrame to be
able to send the binary data because XmlHttpRequest v1 (IE 8/9/10 I think)
doesn't support sending binary.
The related code is at
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L623

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Feb 12, 2015 at 11:36 PM, mscoon <ms...@gmail.com> wrote:

> Since no-one has responded, let me try to rephrase the question: is wicket
> doing something different when submitting a form via ajx without and with a
> FileUploadField? If yes, could you please give me some pointers in the code
> to look at?
>
> Thanks
> Marios
>
> On Tue, Feb 10, 2015 at 4:36 PM, mscoon <ms...@gmail.com> wrote:
>
> > Hi all,
> >
> > We are seeing strange behavior in a form that contains a FileUploadField
> > when submitted with an AjaxSubmitLink. What happens is:
> > 1. The form is embedded in another form, so wicket renders it as a div
> > 2. The form is removed from it's parent element and placed within a
> JQuery
> > dialog
> > 3. The outher form contains a FileUploadField
> >
> > When the inner form is submitted we get the following error in the ajax
> > debug panel:
> > "Cannot submit form with id criteria69 because there is no form element
> in the hierarchy."
> >
> > Removing the FileUploadField makes the error disappear, even though there
> > is no form element in the hierarchy due to step (2) above.
> >
> > Any ideas why this is happening?
> >
> > Thanks
> > Marios
> >
>

Re: Ajax submit form with FileUploadField

Posted by mscoon <ms...@gmail.com>.
Since no-one has responded, let me try to rephrase the question: is wicket
doing something different when submitting a form via ajx without and with a
FileUploadField? If yes, could you please give me some pointers in the code
to look at?

Thanks
Marios

On Tue, Feb 10, 2015 at 4:36 PM, mscoon <ms...@gmail.com> wrote:

> Hi all,
>
> We are seeing strange behavior in a form that contains a FileUploadField
> when submitted with an AjaxSubmitLink. What happens is:
> 1. The form is embedded in another form, so wicket renders it as a div
> 2. The form is removed from it's parent element and placed within a JQuery
> dialog
> 3. The outher form contains a FileUploadField
>
> When the inner form is submitted we get the following error in the ajax
> debug panel:
> "Cannot submit form with id criteria69 because there is no form element in the hierarchy."
>
> Removing the FileUploadField makes the error disappear, even though there
> is no form element in the hierarchy due to step (2) above.
>
> Any ideas why this is happening?
>
> Thanks
> Marios
>