xforms:submit

Purpose

A form control that initiates submission of the form data for processing.

Contains

Attributes

Attribute Description Type Default Options Use
ref This attribute is part of the XForms schema, but in the context of a submit action it has no meaning. You therefore need not set it. xs:NCName none    optional 
submission The identifier of the submission element that defines how the form is submitted xs:IDREF none    required 

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>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="test.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 test.jsp file may contain the following code.

Note:

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

<?xml version="1.0" encoding="UTF-8"?>
<%
response.setContentType("x-application/vnd.xdime+xml");
String name = request.getParameter("name");
String postcode = request.getParameter("postcode");
String hidden = request.getParameter("hidden");
%>
<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>
      <h4>Hello <%=name%> (<%=hidden%>) Postcode: <%=postcode%> </h4>
    </div>
  </body>
</html>

Related topics