XForms-Transitional Testbed - min and max values

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 adds min and max attributes to the input element for use with the number and date data types. The value of min and max must a literal. A further experiment will introduce the validate attribute to cater for expressions that may act over other form fields.

Please view the XForms-Transitional script for more details on how this works.

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" datatype="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" datatype="date" min="7 Oct 2006"/>
</fieldset>
</form>

Comments

The min and max values are checked when the form is loaded and whenever the field is updated. For dates, the value can be a date string or a number in milliseconds since midnight 01 January, 1970 UTC. The min and max constraints are only applied in the case that the type attribute is "number" or "date". It remains an open question as to whether min and max should be literals or whether expressions are acceptable. Literals make it easier to initialize data pickers and range controls, as well as avoiding dependency issues for expressions involving other form fields.

Dave Raggett <dsr@w3.org>