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

RE: xforms:copy binding query

From: Aaron Reed <aaronr@us.ibm.com>
Date: Tue, 23 Oct 2007 17:22:59 -0600
To: John Boyer <boyerj@ca.ibm.com>
Cc: "Robert Walpole" <robert.walpole@devon.gov.uk>, www-forms@w3.org, www-forms-request@w3.org
Message-ID: <OFAED24438.4B9373D3-ON8725737D.007F3A13-8625737D.00804941@us.ibm.com>

Hey John,

Took me a while, but I finally found what I was looking for in the 1.0
spec.  I assume all of this stuff is still in the 1.1 spec, but the section
numbers may have changed.

The first thing I found in the spec was the example in 2.2 "An initial
value ("cc") for the form control is provided through the instance data, in
this case an attribute method. In the submitted XML, this initial value
will be replaced by the user input, if the user changes the form control
displaying that data. "

Section 8.1.1 says, "Form controls that write simpleContent to instance
data must do so exactly as defined by the XForms Action 10.1.9 The setvalue
Element "  Since you agree that xf:value and xf:copy should behave the
same, then this applies to our select example.

Section 10.1.9 for xf:setvalue it says, "Element nodes: If the element has
any child text nodes, the first text node is replaced with one
corresponding to the new value. If no child text nodes are present, a text
node is created, corresponding to the new value, and appended as the first
child node. "

So the 'why' you were looking for is because we gotsto. :-)

--Aaron
IBM Corporation
Internal Zip: 9022D016
11501 Burnet Road
Austin, TX 78758
(512)838-9948
inet: aaronr@us.ibm.com
  _
 (} @
 |=     Volleyball Rules!!!
/\




                                                                           
             John Boyer                                                    
             <boyerj@ca.ibm.co                                             
             m>                                                         To 
                                       Aaron Reed/Austin/IBM@IBMUS         
             10/23/2007 06:06                                           cc 
             PM                        "Robert Walpole"                    
                                       <robert.walpole@devon.gov.uk>,      
                                       www-forms@w3.org,                   
                                       www-forms-request@w3.org            
                                                                   Subject 
                                       RE: xforms:copy binding query       
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           






>But if you select a value from the second select (none of whose values
appear in the first select), ALL of the previous values under that bound
node will disappear in favor of the items selected in this second select.

Hmm. Why?

If you add a new value to a select, and the other values in the referenced
node DO match other items in the same select, then choosing one item would
not erase the others.   Why would choosing an item in a select ever replace
any other selections that have been made, whether or not those other
selections match items in the select?

I agree with value and copy behaving the same way, of course.

John M. Boyer, Ph.D.
STSM: Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer



                                                                           
 Aaron Reed                                                                
 <aaronr@us.ibm.com>                                                       
 Sent by:                                                                  
 www-forms-request@w3                                                   To 
 .org                        John Boyer/CanWest/IBM@IBMCA                  
                                                                        cc 
                             "Robert Walpole"                              
 10/23/2007 03:59 PM         <robert.walpole@devon.gov.uk>,                
                             www-forms@w3.org, www-forms-request@w3.org    
                                                                   Subject 
                             RE: xforms:copy binding query                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





Hey John,

Selecting an item that contains a xf:copy behaves, in my experience (and
certainly in Mozilla), just like selecting an item that contains a xf:value
except that elements can be placed under the bound node instead of just
text. So let's forget xf:copy for now. Let's just look at two xf:selects
that bind to the same node, each with itemsets that are bound to different
nodes such that no value from one select appears in the other. If you
select an item from the first select, that value will be copied into the
bound node. Any number of items from that select can be selected, and their
values will be placed under the bound node, separated by spaces. But if you
select a value from the second select (none of whose values appear in the
first select), ALL of the previous values under that bound node will
disappear in favor of the items selected in this second select.

I don't see any reason that copy should behave any differently.

--Aaron
IBM Corporation
Internal Zip: 9022D016
11501 Burnet Road
Austin, TX 78758
(512)838-9948
inet: aaronr@us.ibm.com
_
(} @
|= Volleyball Rules!!!
/\


Inactive hide details for John Boyer <boyerj@ca.ibm.com>John Boyer
<boyerj@ca.ibm.com>
                                                                           
 John Boyer                                                                
 <boyerj@ca.ibm.com>                                                       
                                                                           
                                                                           
 10/23/2007 04:58 PM                                                       
                                                                        To 
                                                                           
                             "Robert Walpole"                              
                             <robert.walpole@devon.gov.uk>                 
                                                                           
                                                                           
                                                                        cc 
                                                                           
                             Aaron Reed/Austin/IBM@IBMUS,                  
                             www-forms@w3.org, www-forms-request@w3.org    
                                                                           
                                                                           
                                                                   Subject 
                                                                           
                             RE: xforms:copy binding query                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





Hi Robert,

What you described makes perfect sense, and so the comments I gave were
indeed applicable.

My comments are based on what XForms, the spec, says and/or implies to me
rather than on what has happened in particular implementations.

The xforms select and select1 controls are supposed to show you those items
that are selected based on matching the content referenced by value or
copy.

You have two different controls with different itemsets. As items are
selected via select A, nodes will be copied to the node referenced by A
(metadata in your example). Then you have select B referencing the same
node, but with an itemset whose items do not match any of the content you
selected with A.

As a result, select B is not able to fully represent the value of the
referenced node (metadata). Due to that fact, the XForms processor is
supposed to dispatch an out of range event to select B. But it is a
notification event that you don't have to handle. Nothing in the spec says
"dispatch out of range and then stop looking for matching content", but it
is conceivable that some implementations may have interpreted this
condition as more of an error than a notification.

In fact, I believe there was an XForms 1.1 last call comment asking for
further clarification on this point. Erik Bruchez is the point man on
writing the clarification, but I believe that the information I am
providing here is consistent with how that "clarification" will be written.


Certainly if you are using chiba and have the ability to change it, then by
all means please make the select controls properly handle "noise" data in
their referenced nodes by dispatching the out of range event and otherwise
showing selections based on nodes that do match.

Thanks,
John M. Boyer, Ph.D.
STSM: Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer

                                                                           
 "Robert Walpole"                                                          
 <robert.walpole@devon.go                                                  
 v.uk>                                                                     
 Sent by:                                                               To 
 www-forms-request@w3.org        John Boyer/CanWest/IBM@IBMCA              
                                                                        cc 
                                 "Aaron Reed" <aaronr@us.ibm.com>,         
 10/23/2007 01:59 PM             <www-forms@w3.org>,                       
                                 <www-forms-request@w3.org>                
                                                                   Subject 
                                 RE: xforms:copy binding query             
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           






Hi John,


Thanks for your reply. To avoid any further confusion I will stick to the
real world example of what I am trying to do.


Basically, I have a target XML node which is a <metadata/> element. On my
form I want to have 2 select controls. One with accessibility options and
one with clientgroup options. Each of these controls is populated with a
different itemset. When the user selects options from the controls I want
the selected items to be placed in the same metadata target node.


In other words, if the user selects 2 options from the accessibiliy list
and 2 options from the clientgroup list I want the resulting XML to look
like something like this.


<metadata>
<accessibility>1</accessibility>
<accessibility>2</accessibility>
<clientgroup>a</clientgroup>
<clientgroup>b</clientgroup>
</metadata>


Previously I have attempted to handle this using xforms:select1 within an
xforms:repeat and an associated trigger to add additional form controls and
therefore multiple elements of the same name. However the more complex the
data model the more cumbersome this becomes and so I am trying to use
xforms:copy as a more elegant solution. The problem I am having with this
is that the bindings to the target node appear to be mutually exclusive and
in the implementation I am using (Chiba) I am physically unable to select
items from both lists. I can select multiple items in one list and then as
soon as I start selecting items in the second list the items in the first
list are deselected and do not show in the submitted data.


I am not sure what you mean by an "out of range event". I assume that this
is something handled by the implementation? In any event a colleague of
mine has added the xforms:copy functionality to Chiba so it is possible we
may be able to modify the behaviour, if appropriate.


It may be that the only answer is to change my model so that each select
control has a different target node. The problem with this is that I am
working with a existing dataset and this kind of restructuring is not
desirable.


Thanks again.
Rob Walpole
Devon Portal Developer
Email robert.walpole@devon.gov.uk
Web http://www.devonline.gov.uk


-----Original Message-----
From: John Boyer [mailto:boyerj@ca.ibm.com]
Sent: 23 October 2007 15:31
To: Robert Walpole
Cc: Aaron Reed; www-forms@w3.org; www-forms-request@w3.org
Subject: RE: xforms:copy binding query


Hi Robert,


It's not clear enough from your first message what you are actually trying
to do. This latest post involving use of insert surely seems to be going in
the wrong direction, though, as the point of copy is that you don't need
generalized insertion capabilities.


I understood that you wanted two different controls to be able to
contribute to a test data result.


OK, so that means the ref of the two controls points at the same node
"/test/data"


But what is the itemset nodeset supposed to point at in the two different
controls?


Are you thinking to have the two itemsets be different?


If so, I think it is only slightly problematic. However, it should be
possible to make it work, and in particular to do so without use of insert,
but there will be a minor hiccup in the fact that each of the select
controls will receive out of range error events for the subtrees placed in
"/test/data" that do not correspond to items in the union of the item sets
but not the complement of their intersection.


In other words, if you have an item generated by control S1 but not S2, and
you select that item, the subtree will be copied into the node referenced
by S1, but S2 should then receive an out of range event because it has no
item to match that copied node. But this is a notification event, which
could be ignored or cancelled.


Finally, perhaps let us know what you really want to do at a higher level,
since a solution other than having two selects with non-identical item sets
might present itself. But if it is exactly what you need, it should in
principle work, modulo the out of range notifications.


Cheers,
John M. Boyer, Ph.D.
STSM: Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab
E-Mail: boyerj@ca.ibm.com


Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer


"Robert Walpole" <robert.walpole@devon.gov.uk>
Sent by: www-forms-request@w3.org
10/23/2007 04:01 AM To"Aaron Reed" <aaronr@us.ibm.com>, <www-forms@w3.org>
cc
SubjectRE: xforms:copy binding query







Hi Aaron,


Thanks for your reply. I understand what you are saying about the
bindings although this does seem a bit of a limitation.


I am interested in your suggestion of using the xforms-select event but
I am struggling to see how this would work.


At present I am just trying to get it to work with one select control
and I have something like the following:


<xforms:model>
<xforms:instance>
<communitygroup>
<data/>
<metadata/>
</communitygroup>
</xforms:instance>
<xforms:bind id="data" nodeset="/communitygroup/data"/>
<xforms:bind id="metadata" nodeset="/communitygroup/metadata"/>
<xforms:instance id="accessibility-instance"
src="accessibility.xml"/>
</xforms:model>


<xforms:select bind="data">
<xforms:label>Metadata</xforms:label>
<xforms:itemset
nodeset="instance('accessibility-instance')/accesstype">
<xforms:label ref="accessterm"/>
<xforms:copy ref="accessibility"/>
<xforms:action ev:event="xforms-select">
<xforms:insert bind="metadata" at="last()"
position="after"/>
<xforms:setvalue ref="."/>
</xforms:action>
</xforms:itemset>
</xforms:select>


However this produces some pretty mangled results and I'm not at all
sure what the bindings should really look like in this case.


Any pointers you (or anyone else) can offer would be much appreciated.


P.S. accessibility.xml attached in case required.


Many Thanks
Rob Walpole
Devon Portal Developer
Email robert.walpole@devon.gov.uk
Web http://www.devonline.gov.uk


> -----Original Message-----
> From: www-forms-request@w3.org
> [mailto:www-forms-request@w3.org] On Behalf Of Aaron Reed
> Sent: 19 October 2007 21:53
> To: www-forms@w3.org
> Subject: Re: xforms:copy binding query
>
>
>
> Hi Rob,
>
> You can certainly bind two selects/select1s to the same node,
> but when
> you select items in a select/select1, it will replace the values
> underneath it. The only way you could mix and mingle them
> are if both
> selects had the same items and you use ctrl+<click> when
> selecting items
> (assuming your process uses a html:select type of control) but then
> there isn't much reason to have both. You could always try
> to manage it
> yourself with binding the two selects to different nodes and then
> handling the xforms-select and xforms-deselect events and
> inserting/deleting the nodes under the 'real' target node yourself..
>
> --Aaron
>
> Robert Walpole wrote:
> > Hi,
> >
> > I am seeking some clarification about how the XForms copy element
> > (http://www.w3.org/TR/2007/WD-xforms11-20070222/#ui-adv-copy) should
> > work.
> >
> > My question is whether it should be possible to use xforms:copy on
> > different xforms:select controls to copy different element
> nodes into
> > the same target node?
> >
> > For example, say I want to have 2 select controls that use use
> > xforms:copy to populate the data node in the following...
> >
> > <test>
> > <data/>
> > </test>
> >
> > In this case I would bind both of my select controls to the
> data nodeset
> > and by selecting two values from both controls I would hope to get
> > something like the following result...
> >
> > <test>
> > <data>
> > <abc>123</abc>
> > <abc>456</abc>
> > <def>321</def>
> > <def>654</def>
> > </data>
> > </test>
> >
> > Is this allowable? It may be that I cannot bind two
> different controls
> > to the same target node. Any clarification of this would be much
> > appreciated.
> >
> > Many Thanks
> > Rob Walpole
> > Devon Portal Developer
> > Email robert.walpole@devon.gov.uk
> > Web http://www.devonline.gov.uk
> >
> >
> >
> >
>
>
>
> (See attached file: pic16743.gif)









graycol.gif
(image/gif attachment: graycol.gif)

pic27819.gif
(image/gif attachment: pic27819.gif)

ecblank.gif
(image/gif attachment: ecblank.gif)

26523225.gif
(image/gif attachment: 26523225.gif)

26898784.gif
(image/gif attachment: 26898784.gif)

pic16743.gif
(image/gif attachment: pic16743.gif)

Received on Tuesday, 23 October 2007 23:29:55 GMT

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