About XForms
- What are XForms
- What is XForm Editor
The purpose of this tutorial is to provide the user basic
information of XForm Editor and Xforms in general.
What are XForms
„ Forms are an important part of the Web, and they continue to be
the primary means for enabling interactive Web applications. Web
applications and electronic commerce solutions have sparked the demand
for better Web forms with richer interactions. XForms 1.0 is the
response to this demand, and provides a new platform-independent markup
language for online interaction between a person (through an XForms
Processor) and another, usually remote, agent. XForms are the successor
to HTML forms, and benefit from the lessons learned from HTML forms. “
[Chapter 1.1 of the XForms
PR]file:///home/cesterbj/xformeditor4jiap/doc/runningXFormEditor.html
Here are the primary benefits:
- XForms improves the user experience
- XForms has been designed to allow much to be checked by the
browser, such as types of fields being filled in, that a particular
field is required, or that one date is later than another. This reduces
the need for round trips to the server or for extensive script-based
solutions, and improves the user experience by giving immediate
feedback to what is being filled in.
- It is XML, and it can submit XML
- XForms is properly integrated into XML: it is in XML, the data it
collects in the form is XML, it can load external XML documents as
initial data, and can submit the results as XML. By including the user
in the XML pipeline, it at last means you can have end-to-end XML,
right up to the user's desktop.
- It combines existing XML technologies
- Rather than reinventing the wheel, XForms uses a number of
existing XML technologies, such as XPath for addressing and calculating
values, and XML Schema for defining data types. This has a dual
benefit: ease of learning for people who already know these
technologies, and the ability for implementors to use off-the-shelf
components to build their systems.
- It is device independent
- The same form can be delivered without change to a
traditional browser, a PDA, a mobile phone, a voice browser, and even
some more exotic emerging clients such as an Instant Messenger. This
greatly eases providing forms to a wide audience, since forms only need
to be authored once.
- It is easier to author complicated forms
- Because XForms uses declarative markup to declare properties of
values, and to build relationships between values, it is much easier
for the author to create complicated, adaptive, forms, without having
to resort to scripting.
- It is internationalized
- Because the data submitted is XML, it is properly
internationalized.
- It is accessible
- XForms has been designed so that it will work equally well with
accessible technologies (for instance for blind users) as with
traditional visual browsers.
XForms can do everything that HTML Forms can do, and then some. In
particular XForms lets you:
- Check data values while the user is typing them in.
- Indicate that certain fields are required, and that the form
cannot be submitted without them.
- Submit forms data as XML.
- Integrate with Web services, for instance by using SOAP and XML
RPC.
- Submit the same form to different servers (for instance a search
string to different search engines).
- Save and restore values to and from a file.
- Use the result of a submit as input to a further form.
- Get the initial data for a form from an external document.
- Calculate submitted values from other values.
- Constrain values in certain ways, such as requiring them to be in
a certain range.
- Build 'shopping basket' and 'wizard' style forms without needing
to resort to scripting.
What is XForm Editor
XForm Editor allows to edit an existent xform document or to build a
new xform document from a xml data flux. Moreover, it allows to
internationalise our xforms choosing desired languages.
To build new xforms, XForm Editor analise data obtained from a generic
xml flux and creates corresponding xform's elements, joining to each
one a bind element containing its properties. Inside each element's
label, there is a reference to corresponding label id in order to find
label's name in language files.
XML Flux Example:
<?xml version="1.0"
encoding="UTF-8"?>
<process>
<name>Example</name>
<properties>
<property>
<name>Property1</name>
<value>value1</value>
<type>input</type>
</property>
<property>
<name>Property2</name>
<value>value2</value>
<type>input</type>
</property>
</properties>
<activityName>Activity1</activityName>
</process>
Generated XForm:
<html
xmlns="http://www.w3.org/2002/06/xhtml2"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<head>
<tittle>ExampleXForm</tittle>
<xf:model id="model">
<xf:instance id="instance" src="contextobject:$instance"/>
<xf:instance id="lang" src="contextobject:$lang"/>
<xf:submission action="" id="bValider" method="post"
replace="all"/>
<xf:bind id="bind1" nodeset="/*[1]/*[2]/*[1]/*[2]"
readonly="false()" relevant="true()" required="false()"
type="string"/>
<xf:bind id="bind2" nodeset="/*[1]/*[2]/*[2]/*[2]"
readonly="false()" relevant="true()" required="false()"
type="string"/>
</xf:model>
</head>
<body>
<xf:group
appearance="maximal">
<xf:label id="projectname"
ref="instance('lang')/string[@id='Example']"/>
<xf:label id="activityname"
ref="instance('lang')/string[@id='Activity1']"/>
<xf:input bind="bind1" ref="/*[1]/*[2]/*[1]/*[2]">
<xf:label ref="instance('lang')/string[@id='Property1']"/>
<xf:alert>Error!</xf:alert>
</xf:input>
<xf:input bind="bind2" ref="/*[1]/*[2]/*[2]/*[2]">
<xf:label ref="instance('lang')/string[@id='Property2']"/>
<xf:alert>Error!</xf:alert>
</xf:input>
<xf:submit submission="bValider">
<xf:label ref="instance('lang')/string[@id='submit']"/>
</xf:submit>
</xf:group>
</body>
<components/>
</html>
Generated language file (english
example):
<?xml version="1.0"
encoding="ISO-8859-1"?>
<strings>
<string id="Example">My Example</string>
<string id="Activity1">My
Activity</string>
<string id="Property1">Id</string>
<string id="Property2">Name</string>
<string id="submit"/>
</strings>