Hi,
I have a question regarding to the XForms Upload element and how it should work. I have the following form: ------------------- 8< ------------------ ... <head> <xforms:instance id="files-instance"> <files xmlns=""> <file displayname="" filename="" mediatype="" size="" xsi:type="xs:anyURI" /> </files> </xforms:instance> ... <xforms:submission id="upload-files-submission" replace="none" ref="instance( 'files-instance' )" action="http://localhost:8080/my-webapp/index.xforms" method="post" mediatype="application/xml" encoding="UTF-8" /> ... </head> <body> <xforms:upload ref="instance( 'files-instance' )/file"> <xforms:filename ref="@filename" /> <xforms:mediatype ref="@mediatype" /> <xxforms:size ref="@size" /> </xforms:upload> ... <xforms:send submission="upload-files-submission" /> ... </body> ... -------------------- 8< --------------- The form works fine and after clicking the send submission button I will receive information about the uploaded file to the files-instance. However, if I will modify the form a bit so that instead of sending the files-instance along with the submission (see the ref attribute) I will first copy the content of the files-instance to another instance, e.g. my-files-submission-instance, and then use the following submission: ------------- 8< -------------- <xforms:submission id="upload-files-submission" replace="none" ref="instance( 'm-files-submission-instance' )" action="http://localhost:8080/my-webapp/index.xforms" method="post" mediatype="application/xml" encoding="UTF-8" /> -------------- 8< ------------ Now, in a "normal" form, without upload controls, this would have the same result, right? However, when the form contains an upload control then the content of it does not get copied -- or the information about the file to be uploaded to be precise, such as mediatype, size, filename and the URI to the file itself. I am not sure, but this is probably due to the fact that the XForms Upload control's ref attribute is pointing to a different instance than the one being submitted and the XForms Upload control gets the information about the file AFTER the submission (clicking the button). Is there a way to get the information about the file to be uploaded before clicking the submission button so that I could send/pass this information to another instance&submission? Or as a work around, do I first need to make a dummy submission. Best regards -Markku -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Markku,
xforms:upload in Orbeon Forms has a behavior which is a little awkward. For most controls, we use Ajax to update the server with client values. Obviously, upload fields are a little different due to the sheer quantity of data they may have to send to the server. You could upload, say, a 100 MB file, and that will take some time. So we decided to take an "explicit" approach: upon submitting an instance to which upload controls are bound, we first ask the client to send any pending uploads. After a while, the instance will contain the data and the submission proceeds. This also means that if you submit an instance to which no uploads are bound, nothing happens, which is disappointing. We would like to improve this at some point. In the meanwhile, you can try to do a "dummy" submission of your first instance to the "test:" URL. This will force uploads while not doing an actual submission. -Erik On Nov 19, 2008, at 6:55 AM, .::: Markku :::. wrote: > Hi, > > > I have a question regarding to the XForms Upload element and how it > should work. > > I have the following form: > ------------------- 8< ------------------ > ... > <head> > <xforms:instance id="files-instance"> > <files xmlns=""> > <file displayname="" filename="" mediatype="" size="" > xsi:type="xs:anyURI" /> > </files> > </xforms:instance> > ... > <xforms:submission id="upload-files-submission" replace="none" > ref="instance( 'files-instance' )" action="http://localhost:8080/my-webapp/index.xforms > " method="post" mediatype="application/xml" encoding="UTF-8" /> > ... > </head> > <body> > <xforms:upload ref="instance( 'files-instance' )/file"> > <xforms:filename ref="@filename" /> > <xforms:mediatype ref="@mediatype" /> > <xxforms:size ref="@size" /> > </xforms:upload> > ... > <xforms:send submission="upload-files-submission" /> > ... > </body> > ... > -------------------- 8< --------------- > > > The form works fine and after clicking the send submission button I > will receive information about the uploaded file to the files- > instance. > > However, if I will modify the form a bit so that instead of sending > the files-instance along with the submission (see the ref attribute) > I will first copy the content of the files-instance to another > instance, e.g. my-files-submission-instance, and then use the > following submission: > ------------- 8< -------------- > <xforms:submission id="upload-files-submission" replace="none" > ref="instance( 'm-files-submission-instance' )" action="http://localhost:8080/my-webapp/index.xforms > " method="post" mediatype="application/xml" encoding="UTF-8" /> > -------------- 8< ------------ > > Now, in a "normal" form, without upload controls, this would have > the same result, right? However, when the form contains an upload > control then the content of it does not get copied -- or the > information about the file to be uploaded to be precise, such as > mediatype, size, filename and the URI to the file itself. > > I am not sure, but this is probably due to the fact that the XForms > Upload control's ref attribute is pointing to a different instance > than the one being submitted and the XForms Upload control gets the > information about the file AFTER the submission (clicking the button). > > Is there a way to get the information about the file to be uploaded > before clicking the submission button so that I could send/pass this > information to another instance&submission? Or as a work around, do > I first need to make a dummy submission. > > Best regards > > > -Markku > > -- > You receive this message as a subscriber of the [hidden email] > mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |