using the fr:databound-switch

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

using the fr:databound-switch

FParsons
I tried using the databound switch this way, but got this error:
"Duplicate id found for static id: true"
Should this work? There is no error if there's only one databound switch.
---------------------------------

                                <fr:databound-switch ref="$current-attachments/ATTACHMENT/NUMBER='Form_001'" >
                                    <xforms:case id="true">
                                        001 attached
                                    </xforms:case>
                                    <xforms:case  id="false" >
                                             001 not attached
                                    </xforms:case>
                                </fr:databound-switch>

                                <fr:databound-switch ref="$current-attachments/ATTACHMENT/NUMBER='Form_002'">
                                    <xforms:case id="true">
                                        002 attached
                                    </xforms:case>
                                    <xforms:case id="false">
                                        002 not attached
                                    </xforms:case>
                                </fr:databound-switch>
----------------------
at http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/databound-switch
it says: "the current case will be the one that has an id equal to the value of that node."... but it looks like Orbeon expects a document-wide unique id for this.

Is this a bug?
-- Francis
Reply | Threaded
Open this post in threaded view
|

Re: using the fr:databound-switch

Alessandro  Vernet
Administrator
Francis,

You can have multiple <fr:databound-switch>, but you can't have in
your code multiple <xforms:case> with the same id (you have two with
the id "true" and two with the id "false"). See attached an example
that has two <fr:databound-switch>, and hence has to use different
ids. This is a consequence of using ids in the <fr:databound-switch>.

If you need the value stored in the instance to be the same, instead
of the <fr:databound-switch>, you can replace your <xforms:case> with
something like <xforms:group
ref=".[$current-attachments/ATTACHMENT/NUMBER='Form_001' = 'true']>.

Alex

On Tue, Jun 8, 2010 at 11:52 AM, FParsons <[hidden email]> wrote:

>
> I tried using the databound switch this way, but got this error:
> "Duplicate id found for static id: true"
> Should this work? There is no error if there's only one databound switch.
> ---------------------------------
>
>                                <fr:databound-switch
> ref="$current-attachments/ATTACHMENT/NUMBER='Form_001'" >
>                                    <xforms:case id="true">
>                                        001 attached
>                                    </xforms:case>
>                                    <xforms:case  id="false" >
>                                             001 not attached
>                                    </xforms:case>
>                                </fr:databound-switch>
>
>                                <fr:databound-switch
> ref="$current-attachments/ATTACHMENT/NUMBER='Form_002'">
>                                    <xforms:case id="true">
>                                        002 attached
>                                    </xforms:case>
>                                    <xforms:case id="false">
>                                        002 not attached
>                                    </xforms:case>
>                                </fr:databound-switch>
> ----------------------
> at
> http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/databound-switch
> it says: "the current case will be the one that has an id equal to the value
> of that node."... but it looks like Orbeon expects a document-wide unique id
> for this.
>
> Is this a bug?
>
>
> -----
> -- Francis
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/using-the-fr-databound-switch-tp2247841p2247841.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws

databound-switch-unittest.xhtml (4K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet