JEP-0141: Data Forms Layout

This JEP defines an extension to the Data Forms protocol enabling an application to specify form layouts.


NOTICE: This JEP is currently within Last Call or under consideration by the Jabber Council for advancement to the next stage in the JSF standards process. For further details, visit <http://www.jabber.org/council/queue.shtml>.


JEP Information

Status: Proposed
Type: Standards Track
Number: 0141
Version: 0.3
Last Updated: 2005-05-03
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core, JEP-0004
Supersedes: None
Superseded By: None
Short Name: xdata-layout

Author Information

Matthew Miller

Email: linuxwolf@outer-planes.net
JID: linuxwolf@outer-planes.net

Legal Notice

This Jabber Enhancement Proposal is copyright 1999 - 2005 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <http://www.opencontent.org/openpub/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocols defined in this JEP have been developed outside the Internet Standards Process and are to be understood as extensions to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.


Table of Contents

1. Introduction
2. Requirements
3. Use Cases
3.1. Paging Fields
3.2. Sectioning Fields
3.3. Including Tables
4. Business Rules
4.1. Discovery
4.2. Field Distribution
4.3. Page Labels and Descriptions
4.4. Section Labels and Descriptions
4.5. Internationalization/Localization
5. Security Considerations
6. IANA Considerations
7. Jabber Registrar Considerations
8. Formal Definition
8.1. <page/> Root Element
8.2. <section/> Element
8.3. <fieldref/> Element
8.4. <reportedref/> Element
8.5. <text/> Element
8.6. XML Schema
Notes
Revision History


1. Introduction

Data Forms [1] ("x:data") provides a simple and interoperable way to request and present information for both applications and humans. However, the simple nature of "x:data" requires the form renderer to use a generic "key/value" format. This JEP builds upon "x:data" to enable applications to specify additional layout information.

2. Requirements

The requirements for this JEP are:

3. Use Cases

This JEP defines a new namespace, "http://jabber.org/protocol/xdata-layout". All layout is defined by "pages" and "sections".

All of the use cases refer to the following form:

Example 1. Sample form

<x xmlns='jabber:x:data' type='form'>
  <title>JSF Application</title>
  <instructions>Please fill out this form</instructions>
  
  <field var='name.first' type='text-single' label='First Name'>
    <required/>
  </field>
  <field var='name.last' type='text-single' label='Last Name'>
    <required/>
  </field>
  <field var='email' type='text-single' label='E-mail Address'>
    <required/>
  </field>
  <field var='jid' type='jid-single' label='Jabber JID'>
    <required/>
  </field>
  
  <field var='background' type='text-multi' label='Background Information'>
  </field>
  <field var='future' type='text-multi' label='Jabber Plans for the Next Six Months'>
  </field>
  <field var='reasoning' type='text-multi' label='Reasons for Joining'>
  </field>
  
  <field var='activity.mailing-lists' type='text-multi' label='Recent Mailing List Activity'>
  </field>
  <field var='activity.jeps' type='text-multi' label='JEPs Authored or Co-Authored'>
  </field>
</x>
  

Note: Any newlines in the following examples are provided for the purpose of legibility only.

3.1 Paging Fields

One of the simplest layout usages is to partition fields into pages. This is done by including one or more <page/> elements within the x:data form. Each <page/> element SHOULD possess a "label" attribute to label the page, MAY contain a <text/> child element for additional information, and SHOULD contain a <fieldref/> element for each field to be included in the page. To reference an x:data field, the <fieldref/> element's "var" attribute MUST be the same as the intended <field/> element's "var" attribute.

Example 2. Pages of fields

<x xmlns='jabber:x:data' type='form'>
  <title>JSF Application</title>
  <instructions>Please fill out this form</instructions>
  <page xmlns='http://jabber.org/protocol/xdata-layout' label='Personal Information'>
    <text>This is page one of three.</text>
    <text>
      Note: In accordance with the JSF privacy policy, your personal information will 
      never be shared outside the organization in any way for any purpose; however, 
      your name and JID may be published in the JSF membership directory.
    </text>
    <fieldref var='name.first'/>
    <fieldref var='name.last'/>
    <fieldref var='email'/>
    <fieldref var='jid'/>
    <fieldref var='background'/>
  </page>
  <page xmlns='http://jabber.org/protocol/xdata-layout' label='Community Activity'>
    <text>This is page two of three.</text>
    <text>
      We use this page to gather information about any JEPs you&apos;ve worked on, 
      as well as your mailing list activity.
    </text>
    <text>You do post to the mailing lists, don't you?</text>
    <fieldref var='activity.mailing-lists'/>
    <fieldref var='activity.jeps'/>
  </page>
  <page xmlns='http://jabber.org/protocol/xdata-layout' label='Plans and Reasonings'>
    <text>This is page three of three.</text>
    <text>You're almost done!</text>
    <text>
      This is where you describe your future plans and why you think you 
      deserve to be a member of the Jabber Software Foundation.
    </text>
    <fieldref var='future'/>
    <fieldref var='reasoning'/>
  </page>
  <field var='name.first' type='text-single' label='First Name'>
    <required/>
  </field>
  <field var='name.last' type='text-single' label='Last Name'>
    <required/>
  </field>
  <field var='email' type='text-single' label='E-mail Address'>
    <required/>
  </field>
  <field var='jid' type='jid-single' label='Jabber JID'>
    <required/>
  </field>
  <field var='background' type='text-multi' label='Background Information'>
  </field>
  <field var='future' type='text-multi' label='Jabber Plans for the Next Six Months'>
  </field>
  <field var='reasoning' type='text-multi' label='Reasons for Joining'>
  </field>
  <field var='activity.mailing-lists' type='text-multi' label='Recent Mailing List Activity'>
  </field>
  <field var='activity.jeps' type='text-multi' label='JEPs Authored or Co-Authored'>
  </field>
</x>
    

Note: The preceding example partitions the fields into three pages, labeled "Personal Information", "Community Activity", and "Plans and Reasonings".

3.2 Sectioning Fields

The next usage of layout is to partition pages into sections. This is done by including one or more <section/> elements within each <page/> element. Each <section/> element SHOULD possess a "label" attribute to identify the section, MAY contain a <text/> child element for additional information, and SHOULD contain a <fieldref/> element for each field to be included in the section. A <section/> element MUST contain at least one <fieldref/> element or <reportedref/> element. To reference an x:data field, the <fieldref/> element's "var" attribute MUST be the same as the intended <field/> element's "var" attribute.

Example 3. Sections of fields

<x xmlns='jabber:x:data' type='form'>
  <title>JSF Application</title>
  <instructions>Please fill out this form</instructions>
  <page xmlns='http://jabber.org/protocol/xdata-layout'>
    <section label='Personal Information'>
      <text>
        Note: In accordance with the JSF privacy policy, your personal information will 
        never be shared outside the organization in any way for any purpose; however, 
        your name and JID may be published in the JSF membership directory.
      </text>
      <fieldref var='name.first'/>
      <fieldref var='name.last'/>
      <fieldref var='email'/>
      <fieldref var='jid'/>
      <fieldref var='background'/>
    </section>
    <section label='Community Activity'>
      <text>
        We use this page to gather information about any JEPs you&apos;ve worked on, 
        as well as your mailing list activity.
      </text>
      <text>You do post to the mailing lists, don't you?</text>
      <fieldref var='activity.mailing-lists'/>
      <fieldref var='activity.jeps'/>
    </section>
    <section label='Plans and Reasoning'>
      <text>You're almost done!</text>
      <text>
        This is where you describe your future plans and why you think you 
        deserve to be a member of the Jabber Software Foundation.
      </text>
      <fieldref var='future'/>
      <fieldref var='reasoning'/>
    </section>
  </page>
  <field var='name.first' type='text-single' label='First Name'>
    <required/>
  </field>
  <field var='name.last' type='text-single' label='Last Name'>
    <required/>
  </field>
  <field var='email' type='text-single' label='E-mail Address'>
    <required/>
  </field>
  <field var='jid' type='jid-single' label='Jabber JID'>
    <required/>
  </field>
  <field var='background' type='text-multi' label='Background Information'>
  </field>
  <field var='future' type='text-multi' label='Jabber Plans for the Next Six Months'>
  </field>
  <field var='reasoning' type='text-multi' label='Reasons for Joining'>
  </field>
  <field var='activity.mailing-lists' type='text-multi' label='Recent Mailing List Activity'>
  </field>
  <field var='activity.jeps' type='text-multi' label='JEPs Authored or Co-Authored'>
  </field>
</x>
    

Note: The preceding example demonstrates a layout similar to the previous example, but using three sections within one page instead of three pages.

As shown in the following example, sections may be nested to produce a more granular partitioning of fields.

Example 4. Sections of fields (nested)

<x xmlns='jabber:x:data' type='form'>
  ...
  
  <page xmlns='http://jabber.org/protocol/xdata-layout'>
    <section label='Personal Information'>
      <text>
        Note: In accordance with the JSF privacy policy, your personal information will 
        never be shared outside the organization in any way for any purpose; however, 
        your name and JID may be published in the JSF membership directory.
      </text>
      <section label='Name'>
        <text>Who are you?</text>
        <fieldref var='name.first'/>
        <fieldref var='name.last'/>
      </section>
      <section label='Contact Information'>
        <text>How can we contact you?</text>
        <fieldref var='email'/>
        <fieldref var='jid'/>
      </section>
      <fieldref var='background'/>
    </section>
    <section label='Community Activity'>
      <text>
        We use this page to gather information about any JEPs you&apos;ve worked on, 
        as well as your mailing list activity.
      </text>
      <text>You do post to the mailing lists, don't you?</text>
      <fieldref var='activity.mailing-lists'/>
      <fieldref var='activity.jeps'/>
    </section>
    <section label='Plans and Reasoning'>
      <text>
        This is where you describe your future plans and why you think you 
        deserve to be a member of the Jabber Software Foundation.
      </text>
      <fieldref var='future'/>
      <fieldref var='reasoning'/>
    </section>
  </page>
  
  ...
</x>
    

Note: The preceding example partitions the fields into one page and three sections, with the first section being further partitioned into two sub-sections and one free-standing field reference.

3.3 Including Tables

Data forms tables (the <reported/> and <item/> elements) can also be included in the layout, using the <reportedref/> element. This element MAY be included anywhere that the <fieldref/> element is allowed, but MUST NOT appear more than once.

If a <reportedref/> element is specified when no <reported/> element is included, then the reference MUST be ignored.

4. Business Rules

4.1 Discovery

Form providers MAY attempt to discover if the recipient of a form supports the data forms layout protocol extension, although implementations are not required to do so. If implemented, Discovery MUST be implemened as defined in Service Discovery [2], using the namespace "http://jabber.org/protocol/xdata-layout" as a feature.

4.2 Field Distribution

In order to prevent the processing from becoming too complex, there are some restrictions in how fields are distributed within the layout.

First, all displayable, modifiable fields (e.g. all except fields of type "FIXED" or "HIDDEN") SHOULD be referenced by a page or section. Any that are not referenced MAY NOT be rendered, although implementations MAY provide some support for this. To include a "FIXED" field in the layout, it MUST possess a "var" attribute.

Second, the same field SHOULD NOT be referenced by more than one page or section. Additionally, a field SHOULD NOT be referenced by the same page or section more than once.

Finally, the order of layout elements SHOULD be maintained. Pages SHOULD be rendered in the order they are defined within the x:data form, and sections and fields SHOULD be rendered in the order they are defined or referenced within a page or section.

4.3 Page Labels and Descriptions

The "label" attribute of the <page/> element is RECOMMENDED (although not required). If it is missing, the renderer MAY display whatever it deems appropriate (including nothing or character data of the containing form's <title/> element).

The <text/> child element of the <page/> element is OPTIONAL. If it is missing, the renderer MAY display whatever it deems appropriate (including nothing or character data of the containing form's <instructions/> element).

4.4 Section Labels and Descriptions

The "label" attribute of the <section/> element RECOMMENDED (but not required). If it is missing, the renderer MAY use whatever it deems appropriate (including nothing).

The <text/> child element of the <section/> element is OPTIONAL. If it is missing, the renderer MAY use whatever it deems appropriate (including nothing).

4.5 Internationalization/Localization

This JEP relies on the internationalization/localization mechanisms provided by XMPP Core [3]. Specifically, labels and descriptions MUST be appropriate for the locale indicated by the containing stanza or <form/> element.

5. Security Considerations

There are no security considerations introduced by this JEP.

6. IANA Considerations

This JEP requires no interaction with the Internet Assigned Numbers Authority (IANA) [4].

7. Jabber Registrar Considerations

The Jabber Registrar [5] shall register the namespace "http://jabber.org/protocol/xdata-layout" as a feature namespace.

8. Formal Definition

8.1 <page/> Root Element

The <page/> element is the root layout element for "http://jabber.org/protocol/xdata-layout" namespace. One <page/> elements is contained within the <x xmlns='jabber:x:data'/> element for each page to be rendered. The <page/> element MAY possess an attribute that specifies a natural-language label for the page, and MAY contain child elements specifying a description, sections of the page, and field and table references.

The 'label' attribute specifies the label for this page. This attribute is OPTIONAL. Its value is any string.

8.2 <section/> Element

The <section/> element is used to further partition the layout within a page. The <section/> element MAY possess an attribute that specifies a natural-language label for the section, and MAY contain child elements specifying a description, subsections, and field and table references.

The 'label' attribute specifies the label for this section. This attribute is OPTIONAL. Its value is any string.

8.3 <fieldref/> Element

The <fieldref/> element is used to situate a form field within the layout. The <fieldref/> element MUST possess a single attribute to identify the field it references, and is otherwise empty.

If a <fieldref/> element within a <page/> or <section/> references a non-existent field, then that reference MUST be ignored.

The 'var' attribute specifies the form field being referenced. This attribute is REQUIRED, and its value SHOULD be the same as the "var" attribute of one of the <field/> elements in the containing form.

8.4 <reportedref/> Element

The <reportedref/> element is used to situate a form "table" (as described by the <reported/< and <item/> elements) within the layout. The <reportedref/> element has no attributes or children.

8.5 <text/> Element

The <text/> element is used to provide natural-language text that describes a page or section, provides instructions or notes about the page or section, and the like. A <page/> or <section/> element MAY contain an unbounded number of <text/> child elements. The XML character data of this element SHOULD NOT contain newlines (the \n and \r characters), and any handling of newlines (e.g., presentation in a user interface) is unspecified herein.

8.6 XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/protocol/xdata-layout'
    xmlns='http://jabber.org/protocol/xdata-layout'
    elementFormDefault='qualified'>

  <xs:element name='page'>
    <xs:complexType>
      <xs:choice minOccurs='0' maxOccurs='unbounded'>
        <xs:element ref='text' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element ref='section' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element ref='fieldref' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element ref='reportedref' minOccurs='0' maxOccurs='unbounded'/>
      </xs:choice>
      <xs:attribute name='label' type='xs:string' use='optional'/>
    </xs:complexType>
  </xs:element>
  
  <xs:element name='section'>
    <xs:complexType>
      <xs:choice minOccurs='0' maxOccurs='unbounded'>
        <xs:element ref='text' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element ref='section' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element ref='fieldref' minOccurs='0' maxOccurs='unbounded'/>
        <xs:element ref='reportedref' minOccurs='0' maxOccurs='unbounded'/>
      </xs:choice>
      <xs:attribute name='label' type='xs:string' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='fieldref'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
          <xs:attribute name='var' type='xs:string' use='required'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name='reportedref' type='empty'/>

  <xs:element name='text' type='xs:string'/>
  
  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
    


Notes

1. JEP-0004: Data Forms <http://www.jabber.org/jeps/jep-0004.html>.

2. JEP-0030: Service Discovery <http://www.jabber.org/jeps/jep-0030.html>.

3. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://www.ietf.org/rfc/rfc3920.txt>.

4. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

5. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.


Revision History

Version 0.3 (2005-05-03)

Renamed <desc/> element to <text/> to avoid confusion with JEP-0004 element names; clarified formal definition of <text/> element; added <text/> elements to examples. (psa)

Version 0.2 (2005-03-28)

JEP Editor review: cleanup of text, examples, and schema. (psa)

Version 0.1 (2004-08-10)

Initial version. (lw)


END