xforms:group

Purpose

Combines a set of form controls into a user interface component. By applying theme properties on this element, you can control where form fragmentation occurs, and define or override at runtime the link texts specified on form fragment layouts.

Note:

MarinerServletRequestContext.findInstance(request).getParameter() must be used to retrieve data passed by fragmented forms.

Note:

A group element can only contain controls from a single form model, i.e. it is not possible to mix controls bound to different form models into one group.

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:group</title>
    <style type="text/css">
      .fragment { mcs-break-after: always; }
    </style>
    <xforms:model id="login">
      <xforms:instance>
        <si:instance>
          <si:item name="firstName"/>
          <si:item name="lastName"/>
        </si:instance>
      </xforms:instance>
      <xforms:submission action="test.jsp" id="submit"/>
    </xforms:model>
  </head>
  <body>
    <h4>Form Fragmentation</h4>
    <xforms:group class="fragment">
      <xforms:input model="login" ref="firstName">
        <xforms:label>Enter Your Name:</xforms:label>
      </xforms:input>
    </xforms:group>
    <xforms:group class="fragment">
      <xforms:input model="login" ref="lastName">
        <xforms:label>Enter Your Surname:</xforms:label>
      </xforms:input>
      <xforms:submit submission="submit">
        <xforms:label>Send</xforms:label>
      </xforms:submit>
    </xforms:group>
  </body>
</html>

The test.jsp file should contain the following code.

<?xml version="1.0" encoding="UTF-8"?>
<%@ page import="com.volantis.mcs.servlet.*" %>
<%
response.setContentType("x-application/vnd.xdime+xml");
String firstName = MarinerServletRequestContext.findInstance(request).getParameter("firstName");
String lastName = MarinerServletRequestContext.findInstance(request).getParameter("lastName");
%>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs">
  <head>
    <title>Form Fragmentation</title>
  </head>
  <body>
    <div>
      <h4>Hello <%=firstName%> <%=lastName%>!</h4>
    </div>
  </body>
</html>

Related topics