xfoption

Purpose

Used to specify an option item.

Contained by

Attributes

Attribute Description Type Default Options Use
caption The caption for the control xs:string none    required 
captionClass Applies an individual style to the caption xs:string none    optional 
captionPane The pane in which the caption will be displayed xs:string none    optional 
class Assigns a class name to an element xs:NMTOKEN none    optional 
entryPane The pane in which the input element of the control will be displayed xs:string none    optional 
expr An MCS expression xs:string none    optional 
id Assigns an identifier to an element xs:ID none    optional 
prompt Prompt text for the control xs:string none    optional 
selected Whether this option is preselected or not xs:string none  true, false  optional 
value The value of the control xs:string none    required 

Examples

<?xml version="1.0" encoding="UTF-8"?>
<canvas layoutName="/forms.mlyt" pageTitle="xfoption">
  <xfform name="formControls" action="download.jsp">
    <xfsiselect name="select" caption="Choose platform" captionPane="controlCaption1"
      entryPane="controlEntry1" initial="linux">
      <xfoption caption="Windows" value="windows"/>
      <xfoption caption="MacOS X" value="mac"/>
      <xfoption caption="Linux" value="linux"/>
    </xfsiselect>
    <xfaction type="submit" caption="Download" captionPane="controlCaption2"
      entryPane="controlEntry2"/>
  </xfform>
</canvas>

For the purpose of this demonstration submitted data will be processed by a simple JSP.

<?xml version="1.0" encoding="UTF-8"?>
<%
response.setContentType("x-application/vnd.xdime+xml");
String platform = request.getParameter("select");
%>
<canvas layoutName="/welcome.mlyt" pageTitle="Forms in XDIME 1">
  <pane name="background">
    <p>You've chosen <%=platform%>!</p>
  </pane>
</canvas>

The forms.mlyt layout may have the following structure.

forms.mlyt

Related topics