saving the data of an xform

View: New views
4 Messages — Rating Filter:   Alert me  

saving the data of an xform

by Jabba Laci :: Rate this Message:

| View Threaded | Show Only this Message


Hi,

I'd have another question: how to save the collected data of an xform?

Currently, I'm making experiments with the XML DB eXist, because such
a database seems to be the easiest way to store XML data. One problem
is that if I specify the name of the output file in the xform (e.g.
http://localhost:8080/exist/rest/db/data.xml), this file will be
overwritten each time the form is sent. That is, the output file
should change each time. One idea is to add a timestamp suffix to the
file name, making it unique. Can it be done on the client side? Or
should it be done through a servlet?

Another thing that troubles me is that if I save the data from an
xform directly to eXist, there is no feedback whether the storage was
successful or not. Because of this reason I'd prefer to control the
saving procedure from a servlet. In that case generating a unique
filename is not a problem.

Or what is the preferred way for this?

Thanks,

Laszlo


Re: saving the data of an xform

by John Boyer :: Rate this Message:

| View Threaded | Show Only this Message


Hi Jabba,

You can dynamically change the URL that the xforms submission connects to.

In XForms 1.0, the "action" attribute only allowed static URLs.
In XForms 1.1, the "action" attribute is still supported but deprecated in favor of using a "resource" attribute.  The reason we renamed the attribute is because it made it possible for us to overload the attribute with a child element of the same name.

You need the "resource" child element, which allows you to overload the URL with a value that is dynamically computed on the client side.  This was so urgently needed, that pretty much all XForms implementations have supported this feature for years now, regardless of the current W3C process phase of XForms 1.1.

An example of the markup is here: http://www.w3.org/MarkUp/Forms/specs/XForms1.1/index-all.html#submit-resource-elem

Note, though, that you can do *any* XPath expression in the value attribute to compute *any* part of the URI using any number of instance data nodes.

Cheers,
John M. Boyer, Ph.D.
STSM, Interactive Documents and Web 2.0 Applications
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@...  

Blog:
http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed:
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw




From: "Jabba Laci" <jabba.laci@...>
To: xforms <www-forms@...>
Date: 11/25/2008 03:48 PM
Subject: saving the data of an xform






Hi,

I'd have another question: how to save the collected data of an xform?

Currently, I'm making experiments with the XML DB eXist, because such
a database seems to be the easiest way to store XML data. One problem
is that if I specify the name of the output file in the xform (e.g.
http://localhost:8080/exist/rest/db/data.xml), this file will be
overwritten each time the form is sent. That is, the output file
should change each time. One idea is to add a timestamp suffix to the
file name, making it unique. Can it be done on the client side? Or
should it be done through a servlet?

Another thing that troubles me is that if I save the data from an
xform directly to eXist, there is no feedback whether the storage was
successful or not. Because of this reason I'd prefer to control the
saving procedure from a servlet. In that case generating a unique
filename is not a problem.

Or what is the preferred way for this?

Thanks,

Laszlo




Re: saving the data of an xform

by Erik Bruchez :: Rate this Message:

| View Threaded | Show Only this Message


Also, regarding saving data to eXist: if an error occurs while doing  
so, you can detect this situation by listening on the xforms-submit-
error event dispatched to the submission used to save to eXist.

-Erik

On Nov 25, 2008, at 3:54 PM, John Boyer wrote:

>
> Hi Jabba,
>
> You can dynamically change the URL that the xforms submission  
> connects to.
>
> In XForms 1.0, the "action" attribute only allowed static URLs.
> In XForms 1.1, the "action" attribute is still supported but  
> deprecated in favor of using a "resource" attribute.  The reason we  
> renamed the attribute is because it made it possible for us to  
> overload the attribute with a child element of the same name.
>
> You need the "resource" child element, which allows you to overload  
> the URL with a value that is dynamically computed on the client  
> side.  This was so urgently needed, that pretty much all XForms  
> implementations have supported this feature for years now,  
> regardless of the current W3C process phase of XForms 1.1.
>
> An example of the markup is here: http://www.w3.org/MarkUp/Forms/specs/XForms1.1/index-all.html#submit-resource-elem
>
> Note, though, that you can do *any* XPath expression in the value  
> attribute to compute *any* part of the URI using any number of  
> instance data nodes.
>
> Cheers,
> John M. Boyer, Ph.D.
> STSM, Interactive Documents and Web 2.0 Applications
> Chair, W3C Forms Working Group
> Workplace, Portal and Collaboration Software
> IBM Victoria Software Lab
> E-Mail: boyerj@...
>
> Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
> Blog RSS feed: http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw
>
>
>
>
> From:
> "Jabba Laci" <jabba.laci@...>
> To:
> xforms <www-forms@...>
> Date:
> 11/25/2008 03:48 PM
> Subject:
> saving the data of an xform
>
>
>
>
>
> Hi,
>
> I'd have another question: how to save the collected data of an xform?
>
> Currently, I'm making experiments with the XML DB eXist, because such
> a database seems to be the easiest way to store XML data. One problem
> is that if I specify the name of the output file in the xform (e.g.
> http://localhost:8080/exist/rest/db/data.xml), this file will be
> overwritten each time the form is sent. That is, the output file
> should change each time. One idea is to add a timestamp suffix to the
> file name, making it unique. Can it be done on the client side? Or
> should it be done through a servlet?
>
> Another thing that troubles me is that if I save the data from an
> xform directly to eXist, there is no feedback whether the storage was
> successful or not. Because of this reason I'd prefer to control the
> saving procedure from a servlet. In that case generating a unique
> filename is not a problem.
>
> Or what is the preferred way for this?
>
> Thanks,
>
> Laszlo
>
>
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



Re: saving the data of an xform

by ankostis :: Rate this Message:

| View Threaded | Show Only this Message


Jabba Laci wrote:
Hi,

I'd have another question: how to save the collected data of an xform?

[...]
Another thing that troubles me is that if I save the data from an
xform directly to eXist, there is no feedback whether the storage was
successful or not. Because of this reason I'd prefer to control the
saving procedure from a servlet. In that case generating a unique
filename is not a problem.

Or what is the preferred way for this?
You can have a look at this "reporting submit-errors code"  if using firefox's xform-plugin which uses the event() function:

http://groups.google.com/group/mozilla.dev.tech.xforms/browse_frm/thread/303d90d1ba1eb081/4049b8c55be30bbd