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

Managing a combination of homogenous / heterogenous sub-trees with xf:select

From: Ogbuji, Chimezie <OGBUJIC@ccf.org>
Date: Tue, 17 Jan 2006 12:05:17 -0500
Message-ID: <E9B52E50D32640449D84BD2A85F9CADF010BA57B@CCHSCLEXMB60.cc.ad.cchs.net>
To: formsPlayer@yahoogroups.com, www-forms@w3.org

Hello, I hope no one minds the cross-posted email, but this problem is
specific to both FormsPlayer and XForms (generally).  I have a user
interface 'pattern' that doesn't seem to quite fit in with the XForms
specification (in it's current state) and was hoping for some guidance.
Basically, the 'parent' element can have (as child nodes) a homogenous
set of sub-trees (the 'item' elements) as well as other additional
children:

<parent>
    <item>
      <value>foo</value>
      <otherData>
         ... snip ...
      </otherData>
    </item>
    <item>
      <value>bar</value>
      <otherData>
         ... snip ...
      </otherData>
    </item>
    <item>
      <value>baz</value>
      <otherData>
         ... snip ...
      </otherData>
    </item>
    
    <otherChild1/>
    <otherChild2/>
</parent>


The values for the 'value' element (under each 'item') are restricted to
a specific list. The most efficient and ideal solution for controlling
the homogenous set of 'item' elements would be to present the user with
a select-many (xforms:select) control (populated with all the possible
values for the 'value' element) which would allow them to:

1) Visually see the items that *have* been picked (foo, bar, and baz -
in this case) 
2) Pick additional 'item' children from the list
3) Remove unwanted 'item' children from the list - by unselecting them

All without touching the other elements (otherChild1,otherChild2) or
overwriting the 'item' elements that *have* been picked already (In
particular, the 'otherData' elements should remain as they were if the
corresponding item isn't deselected from the list)

Using xforms:select and xforms:copy:

<xf:instance id='values'>
    <values>
        <item>
          <value>foo</value>
          <otherData/>
        </item>
        <item>
          <value>bar</value>
          <otherData/>
        </item>
        <item>
          <value>baz</value>
          <otherData/>
        </item>
        <item>
          <value>alpha</value>
          <otherData/>
        </item>  
        <item>
          <value>beta</value>
          <otherData/>
        </item>    
    </values>
</xf:instance>


<select xmlns='http://www.w3.org/2002/xforms' ref="parent">
  <label>Values</label>
  <itemset nodeset="instance('values')/item">
    <label ref="value"/>
    <copy ref="."/>
  </itemset>
</select>


However, I was under the impression (and perhaps I'm wrong about this -
since I wasn't able to confirm it in the 1.0 specification) that the
copy element has a side effect of 'destroying' the existing children of
'parent' in reponse to any interaction with the list.  For example, if
'alpha' was picked from the xforms:select list, the other children
(otherChild1, and otherChild2) would be destroyed and the parent subtree
would become:

<parent>
    <item>
      <value>foo</value>
      <otherData>
         ... snip ...
      </otherData>
    </item>
    <item>
      <value>bar</value>
      <otherData>
         ... snip ...
      </otherData>
    </item>
    <item>
      <value>baz</value>
      <otherData>
         ... snip ...
      </otherData>
    </item>
    <item>
          <value>alpha</value>
          <otherData>
             ... snip ...
          </otherData>
    </item>
</parent>

With the existing 'item' children remaining exactly as they were in the
hierarchy originally.  Is this true? If so, I'm interested in a solution
that would remain within the scope of XForms, wouldn't require any
scripting trickery (or a minimum amount, if neccessary), and behave in
the way outlined above.

Chimezie Thomas-Ogbuji
Lead Systems Analyst
Thoracic and Cardiovascular Surgery
Cleveland Clinic Foundation
9500 Euclid Avenue/ JJ40
Cleveland, Ohio 44195
Office: 216-444-8593


------------------------------------------------------------------------------
Confidentiality Note:  This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error,  please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy.  Thank you.
------------
Visit us online at our award-winning http://www.clevelandclinic.org for a complete listing of Cleveland Clinic services, staff and locations from one of the country's leading hospitals.
==============================================================================
Received on Tuesday, 17 January 2006 17:06:40 GMT

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