W3C home > Mailing lists > Public > www-forms@w3.org > October 2006

Re: forms-lite and data models

From: Dave Raggett <dsr@w3.org>
Date: Fri, 27 Oct 2006 19:54:10 +0100 (BST)
To: John Boyer <boyerj@ca.ibm.com>
Cc: mark.birbeck@x-port.net, Francisco Monteiro <monterro2004@tiscali.co.uk>, www-forms@w3.org
Message-ID: <Pine.LNX.4.64.0610271933370.5419@holly>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:07 GMT