Upload submission challenge!

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Upload submission challenge!

Mike Ahlers
Hi,

I've the following situation, with the following solution (I think):

A form, with double file upload and some other inputs. Now, I need to validate both files and parse them, and possible convert them!

First file is a wav file, and needs to be in a specific format.
Second file is a csv file, with possible lots of entries. All entries need to be in the right format.

With a normal xforms submission, I can call a pipeline to persist it for example. With an upload, the submission, is basically an upload, and not a 'persistence' button so to speak. Unless I am not quite understanding the whole submission thing here.

So, my current solution (yet to be implemented) looks like this:

I have an 'upload' submission (I still want a single button to activate the whole lot). This will set attributes of the files uploaded. Using a xforms-ready event, I can look for the presence of these and trigger a pipeline to parse the content (which will validate and convert). This pipeline will return an xml with errors or not.

Based on that, I have yet another xforms-ready event, which either shows errors, or, I call the 'service-layer' pipeline and finally show an 'result' page.

Does the above sound plausible? Or is there a more efficient way of achieving what I want? Like, for example calling a single pipeline?

All suggestions welcome!

- Mike
Reply | Threaded
Open this post in threaded view
|

Re: Upload submission challenge!

Alessandro Vernet
Administrator
Mike,

On Wed, Aug 20, 2008 at 2:01 PM, Mike Ahlers
<[hidden email]> wrote:
> First file is a wav file, and needs to be in a specific format.
> Second file is a csv file, with possible lots of entries. All entries need
> to be in the right format.

I implemented something here to deal with a very similar situation where
I wanted to verify that a Word document attached to form was in the
right format. What I did what to run a submission replace="instance"
which sends the instance to an XPL that checks the format of the file.
If the format is not valid, the XPL returns an XML document indicating
the error. The error is then detected by the XForms so it can tell the
user about it. Because the attached files can be large, I use
type="xs:anyURI", and the URI to the temporary file remains valid for
the duration of the session. I think that this is quite similar to the
solution you describe.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Upload submission challenge!

Mike Ahlers
Hi Alex,

Alessandro Vernet wrote
...

What I did what to run a submission replace="instance"
which sends the instance to an XPL that checks the format of the file.
If the format is not valid, the XPL returns an XML document indicating
the error. The error is then detected by the XForms so it can tell the
user about it. Because the attached files can be large, I use
type="xs:anyURI", and the URI to the temporary file remains valid for
the duration of the session. I think that this is quite similar to the
solution you describe.

Alex
...
Yes, thats exactly what I want to achieve. But currently, I am confused with the upload control example compared to what is running as example on the orbeon website.

The example:
http://www.orbeon.com/ops/xforms-upload/
Does not trigger an instant upload, but the button below invokes the upload. My problem is, that I want also to submit the instance to a pipeline while it doesn't. It is unclear how to do this.

The form builder example, placing an upload and using it. As soon I 'select' a file which I want to upload, it *is* uploaded instantly.

This causes the confusion, for I see different behaviours. Is this some feature that is possible with 3.7.0 and not with 3.6.0?

I want to pass the xml, using the server references for the uploaded files to a pipeline. Do my stuff, and come back with an xml showing errors or none at all. Which then should trigger a call to another pipeline. In short, my button does not much at all, other than uploading. Or rather, I see my instance being populated with uploaded file statistics...

- Mike
Reply | Threaded
Open this post in threaded view
|

Re: Re: Upload submission challenge!

Alessandro Vernet
Administrator
Hi Mike,

On Wed, Aug 27, 2008 at 3:28 PM, Mike Ahlers
<[hidden email]> wrote:
> The example:
> http://www.orbeon.com/ops/xforms-upload/
> Does not trigger an instant upload, but the button below invokes the upload.
> My problem is, that I want also to submit the instance to a pipeline while
> it doesn't. It is unclear how to do this.

In that example, the button runs the following submission:

<xforms:submission id="background-submission" method="post"
replace="all" action="/xforms-upload/" instance="response-instance"/>

If you want the file to be submitted to your own XPL, you will set the
action to point to a path which is mapped to your XPL in the page flow.
Does this make sense?

> The form builder example, placing an upload and using it. As soon I 'select'
> a file which I want to upload, it *is* uploaded instantly.

This is done by doing the submission upon xforms-select, which is sent
when a file is selected.

> This causes the confusion, for I see different behaviours. Is this some
> feature that is possible with 3.7.0 and not with 3.6.0?

The xforms-select event on <xforms:upload> has most likely been
implemented after 3.6. But I would recommend you work with a 3.7 beta 1
or newer anyway :).

> I want to pass the xml, using the server references for the uploaded files
> to a pipeline. Do my stuff, and come back with an xml showing errors or none
> at all.

So then, inside the <xforms:submission>, you can have an event handler
for xforms-submit-done which depending on what is returned loads the
other page (xforms:load) or shows the errors to the user.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
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