Re: forms-lite and data models

I've done some more work on the testbed and have two new experiments 
to show you.

    http://people.w3.org/~dsr/forms-lite/10/

which demonstrates partial initialization of a repeating fieldset by 
virtue of including the fields for the rows you want to initialize. 
Subsequent rows are initialized as unfilled.

   http://people.w3.org/~dsr/forms-lite/14/

which takes John's bill-to/ship-to example and extends it to 
illustrate calculations that reference into named fieldsets, and
the ability to determine the relevancy of fieldsets based upon the 
values of other fields, in this case a checkbox.

The interesting part of the markup is:

   <p><label for="f10">Will be shipped to</label>
   <input id="f10" name="shipCity" readonly="readonly"
   calculate="difship ? shipto.city : billto.city"/></p>

where difship names the checkbox which indicates whether the order 
should be shipped to a different address. The references to the city 
in the ship to and bill addresses use the name of the corresponding 
fieldset as a prefix. I have also made use of the JavaScript 
conditional operator (?:) to pull out the correct city. This is
based upon providing an alternative object model for forms which
makes explicit the hierarchy as defined by fieldset elements.
The existing form object model is also available, and that is
important for graceful degradation.

HTML's forms object model assumes a flat namespace. You must 
therefore avoid giving a fieldset the same name as an input or 
select element. The use of "." to delimit compound field names is 
consistent with JavaScript. If the XPath syntax were adopted, the 
delimiter would instead be "/", and another operator would need to 
be used for division. My guess is that most web developers would 
prefer the JavaScript syntax, given the ability to call JavaScript 
functions and to access JavaScript global variables from within 
forms-lite expressions. However, this is worthy of further study.

One challenges emerging from all of this is what declarative support
could be provided for summarising form contents. This can also be
thought of providing a natural language realizer for form instances.
That seems like an opportunity for a server-side service using Ajax.

p.s. I have also added a date picker for date fields.

  Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett

Received on Friday, 27 October 2006 18:54:42 UTC