xforms:select

Purpose

A form control that provides for selection of one or more choices from a list of options. You may specify the initial state of the xforms:select control using the comma-separated list of values.

Note:

Use the mcs-selection-list-style property to control visual appearance of the selection controls. Refer to Form properties for further information.

Contains

Attribute groups

Examples

<?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>xforms:select</title>
    <xforms:model id="selection">
      <xforms:instance>
        <si:instance>
          <si:item name="list">London,Sydney</si:item>
        </si:instance>
      </xforms:instance>
      <xforms:submission id="submit" action="test.jsp"/>
    </xforms:model>
  </head>
  <body>
    <xforms:select model="selection" ref="list" style="mcs-selection-list-style: controls;">
      <xforms:label>Search by city</xforms:label>
      <xforms:item>
        <xforms:label>London</xforms:label>
        <xforms:value>London</xforms:value>
      </xforms:item>
      <xforms:item>
        <xforms:label>Paris</xforms:label>
        <xforms:value>Paris</xforms:value>
      </xforms:item>
      <xforms:item>
        <xforms:label>Sydney</xforms:label>
        <xforms:value>Sydney</xforms:value>
      </xforms:item>
    </xforms:select>
    <xforms:submit submission="submit">
      <xforms:label>Submit</xforms:label>
    </xforms:submit>
  </body>
</html>

The following JSP retrieves multiple parameters, and their values.

<?xml version="1.0" encoding="UTF-8"?>
<%@ page import="java.util.*" %>
<%
response.setContentType("x-application/vnd.xdime+xml");
%>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs">
  <head>
    <title>Form Submission</title>
  </head>
  <body>
    <div>
      <% 
      for(Enumeration pNames = request.getParameterNames();
        pNames.hasMoreElements();) {
        String pName = (String)pNames.nextElement();
        String[] pValues = request.getParameterValues(pName);
        out.println("Parameter '"+ pName +"': " );
        %>
          <mcs:br/>
        <%  
        for(int i=0; i < pValues.length;i++) {
          out.println("- " + pValues[i]);
          %>
            <mcs:br/>
          <%                  
        }
      }
      %>
    </div>
  </body>
</html>

Related topics