W3C home > Mailing lists > Public > www-forms@w3.org > July 2008

Re: Question about form design with optional elements

From: Swithun Crowe <swithun@swithun.servebeer.com>
Date: Thu, 17 Jul 2008 08:20:20 +0100 (BST)
To: "Clark, John" <CLARKJ2@ccf.org>
cc: www-forms@w3.org
Message-ID: <alpine.LNX.1.10.0807170814330.3394@shadrach>

Hello

CJ Another approach is to start with a maximal base instance,
CJ 
CJ   <xf:instance id="maximal-base">
CJ     <X>
CJ       <a/>
CJ       <b/>
CJ       <c/>
CJ     </X>
CJ   </xf:instance>
CJ 
CJ and then remove any of the optional elements that are "empty" when the 
CJ instance is submitted.  This approach requires expanding the starting 
CJ state of the instance data to its maximal form before editing, and then 
CJ pruning it back again after editing.  Our experiments have performed 
CJ both expanding and pruning on the server side, although it may be 
CJ possible to do these operations using XForms itself.  For example, 
CJ pruning could be implemented using some creative "relevance" MIPs.  

This is what relevance is for. It needn't be very creative. Something 
like:

<xf:bind nodeset="instance('maximal-base')/*" relevant=".!=''"/>

would do it. You might need to use CSS to ensure that elements are still 
visible and editable while they are empty. But relevance will remove the 
empties before the instance is submitted.

Swithun.
Received on Thursday, 17 July 2008 08:19:45 GMT

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