XForms-Transitional Testbed - export to XForms

This is part of a series of cross-platform experiments in incremental extensions to HTML4 forms that provide a stepping stone towards the much richer capabilities in XForms. This particular experiment focuses on mappings to XForms using examples from XForms for HTML Authors.


The export library supports two ways to associate a label with a group of radio buttons or checkboxes. One is to use an enclosing fieldset element together a legend element. The other is to use a label element, whose for attribute references the name of the group rather than the id of a particular field.



The exported markup will be show below here. The original markup can be viewed further down this page.

The original markup for the above form is (back to exported markup):

<form action="http://example.com/search" method="get" onsubmit="false">
<!-- simple text field with label -->
<label for="f1">Find</label>
<input id="f1" type="text" name="query"/>

<!-- text area element with label -->
<label class="top" for="f2">Message</label><br/>
<textarea id="f2" name="message" rows="4" cols="60"></textarea>

<!-- grouped radio buttons -->
<legend for="gender">Gender</legend>
<input id="f3" type="radio" name="gender" value="male">
<label for="f3">Male</label>

<input id="f4" type="radio" name="gender" value="female">
<label for="f4">Female</label>

<!-- grouped checkboxes and associated label -->
<label for="flavor"
title="go on, spoil yourself">Flavors</label>
<input id="f5" type="checkbox" name="flavor" value="vanilla">
<label for="f5">Vanilla</label>

<input id="f6" type="checkbox" name="flavor" value="strawberry">
<label for="f6">Strawberry</label>

<input id="f7" type="checkbox" name="flavor" value="chocolate">
<label for="f7">Chocolate</label>

<!-- independent checkbox -->
<label for="f8">Are you married?</label>
<input id="f8" type="checkbox" name="married" value="married">

<!-- select one choice from list -->
<lable for="f9">Drink:</label>
<select id="f9" name="drink">
   <option selected value="none">None</option>
   <optgroup label="Soft drinks">
      <option value="water">Water</option>
      <option value="milk">Milk</option>
      <option value="juice">Juice</option>
   <optgroup label="Wine and beer">
      <option value="red">Red Wine</option>
      <option value="white">White Wine</option>
      <option value="beer">Beer</option>

<!-- submit button -->
<input type="submit" value="Submit to website">
Dave Raggett <dsr@w3.org>