About XForms


  1. What are XForms
  2. 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 can do everything that HTML Forms can do, and then some. In particular XForms lets you:

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>