Using <select1> to control a <switch>

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using <select1> to control a <switch>

alex.worrell
Hi

I am trying to use a <select1> to control the appearance of items on a form. The idea is to have three options with the display showing something different depending on the option selected. For example:

+ Option1 O Option2 O Option3
Label1: Input1
Label2: Input2

O Option1 + Option2 O Option3
Label3: Input3

O Option1 O Option2 + Option3
Label4: Input4

I have implemented the sub displays using a <switch> and first tried changing the display by detecting DOMActivate on the <item> and using a <toggle> as appropriate. This did not work.

I then tried setting the selected attribute on each <case> using an xpath query that tested the value of the instance data that the <select1> is bound to. This has not worked either. (I do not know if this is possible or not, can selected only take true/false contstants or can it take anything that will avaluate to true/false?)

Can anyone think of any other way of doing this or is it not yet possible to implement this way.

Thanks

Alex



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Using <select1> to control a <switch>

Erik Bruchez
Administrator
Alex,

 > I am trying to use a <select1> to control the appearance of items on
 > a form. The idea is to have three options with the display showing
 > something different depending on the option selected. For example:
 >
 > + Option1 O Option2 O Option3
 > Label1: Input1
 > Label2: Input2
 >
 > O Option1 + Option2 O Option3
 > Label3: Input3
 >
 > O Option1 O Option2 + Option3
 > Label4: Input4
 >
 > I have implemented the sub displays using a <switch> and first tried
 > changing the display by detecting DOMActivate on the <item> and
 > using a <toggle> as appropriate. This did not work.
 >
 > I then tried setting the selected attribute on each <case> using an
 > xpath query that tested the value of the instance data that the
 > <select1> is bound to. This has not worked either. (I do not know if
 > this is possible or not, can selected only take true/false
 > contstants or can it take anything that will avaluate to
 > true/false?)

No, this is not possible: the @selected attribue has to be statically
defined.

 > Can anyone think of any other way of doing this or is it not yet
 > possible to implement this way.

Yes, use xforms:group and relevance:

<xforms:group ref=".[/my/option = 'option1']"
   ...
</xforms:group
<xforms:group ref=".[/my/option = 'option2']"
   ...
</xforms:group
<xforms:group ref=".[/my/option = 'option3']"
   ...
</xforms:group

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Using <select1> to control a <switch>

alex.worrell
Thanks Erik thats perfect.



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws