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

RE: Another <bind> and <repeat> question. And indirect relationsh ips between binds and controls..

From: Tomayko, Ryan <Ryan_Tomayko@stercomm.com>
Date: Mon, 22 Oct 2001 12:52:50 -0400
Message-ID: <5FD6397E455FD4118BAE000629383540014834C4@scidubmsg02.isg.stercomm.com>
To: www-forms@w3.org
Thanks Josef,

> Hope this helps. If you could shed some light on what this is useful
> for?

I was just trying to clear up some botched implementation details on my
part. My initial understanding was that form controls had a one to one
relationship with either a bind element or a node in the instance document.
I was missing the whole idea of maintaing relationship info for nodes in the
instance document, and therefore did not have the many-to-many you describe
between form controls and bind's.

A possible addition to the spec could be a p-code example (like the
recalculation process) that describes the relationships between bind
elements, nodes in the instance document, and form controls.

Your response cleared up a huge gap in my understanding, thanks!

- Ryan

-----Original Message-----
From: Josef Dietl [mailto:josef@mozquito.com]
Sent: Monday, October 22, 2001 12:43 PM
To: Tomayko, Ryan; www-forms@w3.org
Subject: RE: Another <bind> and <repeat> question. And indirect
relationships between binds and controls..


Hi Ryan,

as far as my understanding goes, your assertion (10.00 on both counts)
is correct. I also agree that this is not always (!) useful. The point
is: with the bind, you can get out of repeat's context node easily,
which is sometimes desirable. However, it should be achieved by other
means.

Please note that your second example yields a different result: in the
first iteration, the context node will be the first line item, and its
price is 10.00. In the second iteration, the context node is the second
line item, with a price of 3.00.

Hence,

> The input in the second 
> example does not
> explicitly reference the bind, yet they both reference the 
> same node in the
> instance doc.

is not correct. In fact, you can get to your conclusion much easier: An
arbitrary number of bind elements may refer to the same node in the
instance, and so can an arbitrary number of form controls. Therefor,
there is an indirect many-to-many relationship between form controls and
bind elements. However, I don't see why this is important.

> This might be better stated as [single-node binding] form 
> controls have a
> one-to-one relationship with a node in the instance document. 
> Nodes in the
> instance document have a one-to-many relationship with bind 
> elements. Is
> this correct, or am I missing something?

This is my understanding of what we wanted to achieve :-) Additionally,
nodes in the instance document have a one-to-many relationship with form
controls (be it single-node binding or nodeset-binding ones).

Hope this helps. If you could shed some light on what this is useful
for?

Thanks!

Josef

> -----Original Message-----
> From: Tomayko, Ryan [mailto:Ryan_Tomayko@stercomm.com]
> Sent: Monday, October 22, 2001 7:15 AM
> To: 'www-forms@w3.org'
> Subject: Another <bind> and <repeat> question. And indirect
> relationships between binds and controls..
> 
> 
> Sorry for the size of this post.
> 
> Is it impossible to use a bind attribute on a form control to 
> reference data
> inside a repeating structure?
> 
> For instance (literally):
> 
> <xf:xform>
>   <xf:instance>
>     <po>
>       <lineitems>
>          <line qty="5" price="10.00"/>
>          <line qty="10" price="3.00"/>
>       </lineitems>
>     </po>
>   </xf:instance>
> 
>   <xf:bindings>
>      <xf:bind id='b1' ref='po/lineitems/line/@price' 
> isValid='number(.) >
> 0'/>
>   </xf:bindings>
> </xf:xform>
> 
> ...
> 
> <xf:repeat nodeset='po/lineitems/line'>
> 	<xf:input bind='b1'/>
> </xf:repeat>
> 
> 
> In this case, the input should have a value of 10.00 on both 
> iterations of
> the repeat because of the first node rule. It seems that the 
> repeat breaks
> the usability of bind in some cases. 
> 
> We should be able to get around this by specifying a ref 
> instead of a bind
> on the input:
> 
> <xf:repeat nodeset='po/lineitems/line'>
> 	<xf:input ref='@price'/>
> </xf:repeat>
> 
> This brings up another question: can form control elements 
> and bind elements
> have an indirect relationship? The input in the second 
> example does not
> explicitly reference the bind, yet they both reference the 
> same node in the
> instance doc. If the form controls and bind elements can have 
> an indirect
> relationship, then form controls and bind elements have a one to many
> relationship. 
> 
> This might be better stated as [single-node binding] form 
> controls have a
> one-to-one relationship with a node in the instance document. 
> Nodes in the
> instance document have a one-to-many relationship with bind 
> elements. Is
> this correct, or am I missing something?
> 
> - Ryan
> 
> Ryan Tomayko <rtomayko@stercomm.com>
> Sterling Commerce
> 
> 
Received on Monday, 22 October 2001 12:53:44 GMT

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