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

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

From: Klotz, Leigh <Leigh.Klotz@xerox.com>
Date: Thu, 10 Aug 2006 13:11:15 -0700
Message-ID: <E254B0A7E0268949ABFE5EA97B7D0CF40219EB59@usa7061ms01.na.xerox.net>
To: <mark.birbeck@x-port.net>, "Kugelman, John" <jkugelman@progeny.net>
Cc: "Flinton Adam" <Adam.Flinton@cfh.nhs.uk>, <www-forms@w3.org>

There are situations in which separation of relevance and context is
necessary to use this "model-based switch" technique.
For example, if you're in a repeat, and then use group/@ref to for
relevance, you can't get your context back.
Leigh.

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Mark Birbeck
Sent: Thursday, August 10, 2006 9:17 AM
To: Kugelman, John
Cc: Flinton Adam; www-forms@w3.org
Subject: 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>

is:

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

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

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
this:

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

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

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.)

Regards,

Mark


-- 
Mark Birbeck
CEO
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
http://www.formsPlayer.com/
Received on Thursday, 10 August 2006 20:12:26 GMT

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