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>


CJ Another approach is to start with a maximal base instance,
CJ   <xf:instance id="maximal-base">
CJ     <X>
CJ       <a/>
CJ       <b/>
CJ       <c/>
CJ     </X>
CJ   </xf:instance>
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 

<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.

Received on Thursday, 17 July 2008 08:19:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:21 UTC