si:item

Purpose

Defines an item of instance data that is required if a form control needs to be initialized, or when data not associated with a form control needs to be provided during form submission.

When the name attribute on si:item element has the same name as a form control, the value of the item is used to initialize that control. Otherwise, it is treated as additional data to be submitted with the form. The name attribute must be unique within a given si:instance element.

Contained by

Attribute

Attribute Description Type Default Options Use
name The name of the data item by which form controls reference this data. It is also the name of the parameter used to hold this value when the form is submitted. xs:string none    optional 
type The type of the data item. Refer to the section entitled Specifying data types in the Specifying data types and validation criteria topic for further information. si:ItemType   mcs:tel, xforms:anyURI, xforms:date, xforms:dateTime, xforms:decimal, xforms:double, xforms:email, xforms:float, xforms:string, xforms:time optional 

Example

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:si="http://www.volantis.com/xmlns/2006/01/xdime2/si"
  xmlns:xforms="http://www.w3.org/2002/xforms">
  <head>
    <title>Subscriber update</title>
    <xforms:model id="address">
      <xforms:instance>
        <si:instance>
          <si:item name="name"/>
          <si:item name="postcode">13004 Marseille</si:item>
          <si:item name="hidden">subscriber_id</si:item>
        </si:instance>
      </xforms:instance>
      <xforms:submission id="submit" action="http://localhost:8080/volantis/response.jsp"/>
    </xforms:model>
  </head>
  <body>
    <p>
      <xforms:input model="address" ref="name">
        <xforms:label>Name:</xforms:label>
      </xforms:input>
    </p>
    <p>
      <xforms:input model="address" ref="postcode">
        <xforms:label>Postcode:</xforms:label>
      </xforms:input>
    </p>
    <xforms:submit submission="submit">
      <xforms:label>Submit</xforms:label>
    </xforms:submit>
  </body>
</html>

The following example illustrates the use of the type attribute.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:si="http://www.volantis.com/xmlns/2006/01/xdime2/si"
  xmlns:xforms="http://www.w3.org/2002/xforms">
  <head>
    <title>data types</title>
    <xforms:model id="contact">
      <xforms:instance>
        <si:instance>
          <si:item name="email" type="xforms:email"/>
        </si:instance>
      </xforms:instance>
    </xforms:model>
  </head>
  <body>
    <div>
      <xforms:input model="contact" ref="email">
        <xforms:label>Email address:</xforms:label>
      </xforms:input>
    </div>
  </body>
</html>

Related topics