Web Forms 2.0 - min and max values

This is part of a suite of test forms for Web Forms 2.0 for a set of shared examples with XForms Transitional. See the corresponding XForms Transitional example. This demo will only work on a Web Forms 2.0 compliant browser (e.g. Opera 9).

Typed fields

Here is the markup for the above form:

<form name="form1" onsubmit="false">
<fieldset>
<legend>Typed fields</legend>
<label for="f1"
 title="must be a number between -5 and 5">Number</label>
<input id="f1" name="x" type="number" size="2" min="1" max="5"/>
<label for="f2"
 title="must be a date not earlier than 7 Oct 2006">Date</label>
<input id="f2" name="y" type="date" min="2006-10-7"/>
</fieldset>
</form>

The min attribute works fine on the numeric field, but I couldn't get it to work on the date field. Another issue with the date field is how to make it display the date in a more human friendly format, e.g. "7 Oct 2006". I have yet to discover a way to do this, although a scripting hack may be feasible. I also would like the date field to behave much more like those on spreadsheets, where you can type a date in a wide variety of formats. The value is reformatted nicely when the input focus moves away, and the spreadsheet author can control the format the date is presented. For what it's worth, Opera 9 on Linux renders the date picker with the week day names overlapping the top part of the row of numbers below. The numeric input field is unable to show 2 digits despite having the size attribute set to 2. I think Opera have failed to allow for the width taken up by the spin up/down controls.

By way of contrast the XForms Transitional markup for this example is the following:

<form name="form1" onsubmit="false">
<fieldset>
<legend>Typed fields</legend>
<label for="f1"
 title="must be a number between -5 and 5">Number</label>
<input id="f1" name="x" type="number" size="2" min="1" max="5"/>
<label for="f2"
 title="must be a date not earlier than 7 Oct 2006">Date</label>
<input id="f2" name="y" type="date" min="7 Oct 2006"/>
</fieldset>
</form>
Dave Raggett <dsr@w3.org>