Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

This example will show you how to save intermediate form data to a local disk.

Sometimes long forms take a while to fill out. You would like to allow users to fill out part of a form, log off, and resume their form when they return. Sometimes this intermediate data can be used as a default template for fields that are re-entered frequently by form users.

By default, XForms will not allow a form to be served from one domain and then access another domain without the user being warned. This could allow a nefarious form to access local files without authorization.

This is reflected in the fact that the "src" tag in the instance can only reference a hard-coded static string. You can not load a local file into an instance if the form was loaded from a web server.

Note that you can read and write a local file on the local file system with an XForms application that supports the file: type such as FireFox. But the forms must have this path statically coded into the XForms instance src attribute.

Step 1: Save to Client

Save instance data:

id="save-instance-to-client"
method="put"
action="file://C:/tmp/xforms/my-data.xml"
replace="instance"
instance="my-instance"
/>

Step 2: Read From Client

Save instance data:

id="read-instance-from-client"
method="get"
action="file://C:/tmp/xforms/my-data.xml"
replace="instance"
instance="my-instance"
/>

Note that to find the file you can use the control:

ref="FilePath">
text/xml

The value of the action attribute in both xf:submissions save-instance-to-file and read-instance-from-file should be a variable: action="file://C:/tmp/xforms/my-data.xml" should be automatically changed to FilePath value.

To get this to work you have to deal with the security concerns...

There was a reference to using the chrome:// prefix not the file:// prefix on one posting..but no example was given. There was also some discussion of saving to a cookie using cookie://

  • [1] Cross Domain Submission
  • [2] Comments from Mark Bireck

Where this page came from

This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

Get each new page of

XForms

Following means one email when a page is added, nothing when a page changes.

Following means one email when a page is added, nothing when a page changes.

Comments

Spinner Logo

Next in XForms

CC BY-SA 4.0
XForms, Tri-Document Loading
CC BY-SA 4.0
The first tab will be for people and the second will be for organizations. ## Screen Image ![Entity Selector Control. Note that only the person names that contain the string 'John' are displayed]( Entity Selector Control. Note that only the person names that contain the string 'John' are displayed (
CC BY-SA 4.0
Note that you **must** have the **xf** prefix on the attribute. This is different then the usual process. Note: This example does not run under the FireFox 0.6 or the 0.7 extension. See [Bug 280368]( for details.
CC BY-SA 4.0
When the user types in the input field we will narrow down the choices using an XPath expression in the repeat **xf:nodeset** attribute. The XPath expression will only match items that begin with specific characters in the xf:input field. ## Screen Images ## Link to working XForms application [Repea
CC BY-SA 4.0
XForms, Inline Repeats
CC BY-SA 4.0
This lab allows you to insert a new row into a tabular structure. We don't use a HTML table here, just a form that updates two items in the model. Here is the input before you add any new data: ## Program Code xmlns=" xmlns:xf=" xmlns:ev=" XForms insert example xmlns=""> Peggy 123 Dan 456 John 789 S