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

Re: Multiple xforms:instance elements vs. relevant="false()"

From: John Boyer <boyerj@ca.ibm.com>
Date: Thu, 8 Feb 2007 09:12:21 -0800
To: "Fennell, Philip" <philip.fennell@hp.com>
Cc: www-forms@w3.org, www-forms-request@w3.org
Message-ID: <OFBEE358D9.C283C292-ON8825727C.005CFA49-8825727C.005E8518@ca.ibm.com>
Hi Philip,

Maybe because I'm reading too fast, but it's not altogether clear what 
you're doing.  If the answer below doesn't work for you, then maybe you 
could post a short example in markup that models the problem you have with 
a minimum of data.

I don't understand why you need two separate instances.  You have some 
data that you are allowed to edit with some controls.  You also want to 
"view" the results of changes.  But in that case you just bind more 
"output" controls to the same data nodes.  You can attach as many controls 
as you like to the same data node.  You can even attach multiple input 
controls to the same node.  Any time you modify a node using a particular 
input control, the result is reflected in all the other controls because 
they are bound to the same node.

If you have two instances, then how do you plan to keep the "source" 
instance and the "view" instance synchronized.  I don't think this is very 
easy (because this isn't the type of thing you'd do in XForms due to the 
ability to attach multiple view controls to the same data node).

However, suppose for some reason you do have two instances.  Maybe not the 
same reason you have right now.  In that case, it sounds like you want to 
submit only one instance and not any other instances.  But this is already 
what a submission does.  A submission allows you to send one instance of 
data (or a part of that instance).  Therefore you don't need any relevance 
binds to force the other instances to be excluded from a submission. The 
act of putting data into a separate instance is enough.  By doing so, you 
are saying that the data in that separate instance is created for some 
separate purpose not related to the first instance.

This is a significant power advantage over older HTML forms, which aren't 
really designed to allow you to have two distinct thoughts in your head at 
the same time.

Anyway, as a final thought, I note that you want to make your "view" be 
readonly.  Maybe you are thinking that you need two instances of data 
because you want to make one instance readonly with a bind and have the 
other instance (the source) be modifiable.  But if you use the xforms 
output control for your view only controls, then they are inherently 
readonly and you can stick with only one data instance (the modifiable 
one).  Since you don't want the view only controls to take input into the 
instance, you shouldn't use input controls.  By using output controls, you 
are communicating that you want only to render the data.

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

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

"Fennell, Philip" <philip.fennell@hp.com> 
Sent by: www-forms-request@w3.org
02/07/2007 04:51 AM


Multiple xforms:instance elements vs. relevant="false()"


I have a scenario where there is a source document (model) and a
rendering (view). I generate an XForm that allows me to both edit the
values of attributes in the source document and see values of attributes
generated in the view. For example, I may define an object in the source
but it has properties that are computed by the viewer.


a) Source and view properties are mutually exclusive.
b) View properties are regarded as read-only.

In these types of situation I see two possible options:

1) Multiple instances.

Create a 'model' xforms:instance and a 'view' xforms:instance in the
same xforms:model. The xforms:bind elements reference the two instances
using the instance(xs:IDREF) function. I believe I'm right in assuming
that I would use the instance() function on the xforms:submission
element's ref attribute to indicate which instance to use (unless the
'model' instance is the first within the xforms:model and therefore the
default instance for submission).

2) relevant = "false()"

Merge the view properties with those of the source element (see note 'a'
above) in a single xforms:instance and then upon their respective
bindings set the 'view' properties to relevant="false()". In this case,
when the form is submitted, I believe the irrelevant nodes will be
removed from the instance that is submitted. All bindings will point to
the same xforms:instance.

Please could I have some 'best practice' guidance as to which option
would be considered more practical/preferable?


Philip Fennell
Received on Thursday, 8 February 2007 17:12:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:55 UTC