Re: toggle/case

I think these are comments that have been made before in the light of  
'common occurring patterns in XForms', which also includes for instance  
default insert and delete triggers/actions on <repeat>.

I think it is worth collecting these common patterns with the aim of  
making them easier in future versions.

Steven Pemberton

On Mon, 29 May 2006 19:58:55 +0200, Mark Seaborne <m_seaborne@mac.com>  
wrote:

>
> Hi,
>
> I'm sure this must have been discussed before (I did look but couldn't  
> see anything obvious), but here I go anyway.
>
> I have got a switch/case construct:
>
> <switch>
> 	<case id="a"/>
> 	<case id="b"/>
> 	<case id="c"/>
> <switch>
>
> , and all I want to do is let the user move along the sequence of cases  
> in document order, a, b, c, or c, b, a. No exceptions.
>
> So, I would really like just a single toggle action that navigates up  
> the cases (a, b, c) and another that navigates down the way. Then I  
> would only need two triggers to navigate through the  switch.
>
> However, XForms 1.0 says that the case attribute on toggle is just "a  
> reference to a case element", so I end up with loads of triggers.
>
> If I have missed something obvious, and this is already possible, then  
> please someone tell me. If not, has anyone implemented anything that  
> makes this easy (or even possible), like allowing @case to take an XPath  
> that evaluates to the name of a case, for example?
>
> I can see that it would be possible to achieve the effect I want in  
> XForms 1.1 (thanks for the hint Nick), but even there it is far from  
> elegant. It seems such an obvious, simple thing to want to achieve that  
> it should be made as easy as something like:
>
> <xforms:trigger>
> 	<xforms:label>Next</xforms:label>
> 	<xforms:next switch="mySwitch" ev:event="DOMActivate"/>
> </xforms:trigger>
>
> <xforms:trigger>
> 	<xforms:label>Previous</xforms:label>
> 	<xforms:previous switch="mySwitch" ev:event="DOMActivate"/>
> </xforms:trigger>
>
> and let the XForms processor worry about remembering which case is  
> current, and is it the first or last one. It must be easier than  
> managing repeat.
>
> And another thing, why should I have to write out ev:event="DOMActivate"  
> everytime I use a trigger? Isn't it obvious?
>
> All the best
>
> Mark
>

Received on Monday, 29 May 2006 19:54:12 UTC