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

Re: Can toggle@case or case@selected be calculated?

From: John Boyer <boyerj@ca.ibm.com>
Date: Thu, 10 Aug 2006 11:47:55 -0700
To: mark.birbeck@x-port.net
Cc: "Flinton Adam" <Adam.Flinton@cfh.nhs.uk>, "Kugelman, John" <jkugelman@progeny.net>, www-forms@w3.org, www-forms-request@w3.org
Message-ID: <OF676D8C65.BA04BE4D-ON882571C6.00666F5B-882571C6.00674A7C@ca.ibm.com>
Also, for XForms 1.1 you will be able to selectively run a toggle based on 
a condition using the 'if' attribute.

It's not pretty but it works. 

Also, at the last face to face meeting, we explored an idea from Mikko 
Honkala that allows us in XForms 1.1 to override an attribute value 
(@action on submission) using a subelement.

Speaking for myself, this idea looks really good to me because it allows 
us to control where we add more variablility, so we can cleanly and more 
quickly consider adding it where it is most needed, such as the toggle and 
setfocus actions.  So, I would think you should be able to say something 

<toggle ...>
    <case value="concat('case-', some/node)"/>


<setfocus ...>
    <control value="concat('control-', some/node)"/>

This is far superior to using 'if', but please beware that it's not 
happening until our group agrees that it is!

John M. Boyer, Ph.D.
Senior Product Architect/Research Scientist
Co-Chair, W3C XForms 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

"Mark Birbeck" <mark.birbeck@x-port.net> 
Sent by: www-forms-request@w3.org
08/10/2006 09:17 AM
Please respond to

"Kugelman, John" <jkugelman@progeny.net>
"Flinton Adam" <Adam.Flinton@cfh.nhs.uk>, www-forms@w3.org
Re: Can toggle@case or case@selected be calculated?

Hi John,

> Has the working group ever considered allowing the active case to be
> calculated declaratively, like relevance?

Yes, I think it's even in a requirements document somewhere!

However, some of the things you describe can already be done. For example:

>     <switch select="concat('case-', x)">
>       <case id="case-1"/>
>       <case id="case-1"/>
>       <case id="case-1"/>
>     </switch>


  <group ref="x[text() = '1']">

  <group ref="x[text() = '2']">

etc. You don't need a bind statement to make this work.

I like this because you can spread the groups about, but if you do
want to keep them together to look more like switch/case, you could do

  <group ref="x">
    <group ref=".[text() = '1']">

    <group ref=".[text() = '2']">

Speaking only for myself, I don't have any problem with making this
kind of construct easier, but I think it would be better to achieve
this through some extra mechanisms, rather than changing switch/case.
By binding that to the model you introduce all sorts of quirky things
like what should happen if the user toggles a case that is bound to
the model--should the underlying data change?

At the moment switch/case is purely a UI construct, and although it
often *feels* like you need to bind it to the model, you'll actually
find that this usually indicates you don't need a switch/case.

That probably sounds a bit obtuse...what I'm getting at is that
switch/case currently operates via an action, rather than being bound
to data. The moment you mix the two, things start to get messy. I
would like to see switch/case kept as something that is action driven,
since that's very useful; but then we could also make it easier to
define 'relevance' sections without having the hassle of creating
extra instances. There are lots of ways that could be done, such as
improving lazy authoring, adding DI selectors, and so on.)



Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
Received on Thursday, 10 August 2006 18:49:07 UTC

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