Using forms in XDIME

In XDIME the xfform element creates a form with extended functions. The contained elements define input, select and action controls in the form. MCS provides for form fragmentation for small displays, user input validation, and help and prompt features for protocols that support them.

In XDIME the xfform element creates a form with extended functions. The contained elements define input, select and action controls in the form. MCS provides for form fragmentation for small displays, user input validation, and help and prompt features for protocols that support them.

Note:

XDIME 2 uses XForms syntax for forms. See Form instance data for details

xfform content model

You define the layouts and themes for a form in the policy editors. Then you bind the layout to the form in XDIME.

<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>
Note:

WML does not permit tables inside forms. If you want a form to be correctly rendered on all devices, you should arrange panes in a single column grid in the Layout editor

Uploading binary data

You can use the xfupload element in a form to upload images or other binary data. The element results in markup only on HTML forms, rendered like the xftextinput element, because there is no way to specify binary file uploads in other protocols.

XDIME validation attributes

You can use text input validation in XDIME. Not all devices support a full range of client-side validation features, and some may be incapable of supporting any validation at all. So it is good practice to use server-side form validation in all events.

However, where it is supported, you can make good use of client-side validation to improve the quality of data submitted by users. It also avoids the need to repeatedly send a form to the server for error checking.

The xftextinput element has several attributes that support validation.

Validators are expressions that define the content patterns for input fields, and specify whether data must be provided or not. You use a validator in the optional validate attribute. See Validating form input for more information.

The maxLength defines the maximum number of characters allowed in a field. Because some validation patterns effectively define the maximum length of valid input, you may not need to use this attribute.

In the errmsg attribute you can define a message to display if the field fails validation.

Note:

You can also use the mcs-input-format style property.

Related topics