Binds, nested repeats

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

Binds, nested repeats

ChrisSpeare
I have a set of xml:

<Manifest>
        <ManifestInformation>
                <Shipment>
                        <TransportEquipment>
                                <ContainerNumber/>
                                <ServiceCode/>
                                <ContainerType/>
                        </TransportEquipment>
                </Shipment>
        </ManifestInformation>
</Manifest>

Where shipment and TransportEquipment are both repeating items.  I want to set the ContainerType as readonly, but only when its value is NC.  I tried:

<xforms:bind nodeset="instance('instance_model_SeaManifest')/ManifestInformation">
    <xforms:bind nodeset="Shipment">
        <xforms:bind nodeset="TransportEquipment">
            <xforms:bind nodeset ="ContainerNumber" readonly="1" if="ContainerNumber = 'NC'"/>
        </xforms:bind>
    </xforms:bind>
</xforms:bind>

But this only sets it as readonly, ignoring the condition.  Any hints as to what I did wrong?
       
Reply | Threaded
Open this post in threaded view
|

Re: Binds, nested repeats

Daniel E. Renfer
Chris,

The readonly property takes an XPath expression that evaluates to a
boolean. So you would want to use true() as opposed to just 1, but
even better, just put readonly=". = 'NC'" and you should be good.
(untested)

--
Daniel E. Renfer
http://kronkltd.net/

On 8/9/07, ChrisSpeare <[hidden email]> wrote:

>
> I have a set of xml:
>
> <Manifest>
>         <ManifestInformation>
>                 <Shipment>
>                         <TransportEquipment>
>                                 <ContainerNumber/>
>                                 <ServiceCode/>
>                                 <ContainerType/>
>                         </TransportEquipment>
>                 </Shipment>
>         </ManifestInformation>
> </Manifest>
>
> Where shipment and TransportEquipment are both repeating items.  I want to
> set the ContainerType as readonly, but only when its value is NC.  I tried:
>
> <xforms:bind
> nodeset="instance('instance_model_SeaManifest')/ManifestInformation">
>     <xforms:bind nodeset="Shipment">
>         <xforms:bind nodeset="TransportEquipment">
>             <xforms:bind nodeset ="ContainerNumber" readonly="1"
> if="ContainerNumber = 'NC'"/>
>         </xforms:bind>
>     </xforms:bind>
> </xforms:bind>
>
> But this only sets it as readonly, ignoring the condition.  Any hints as to
> what I did wrong?


--
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: Binds, nested repeats

Alessandro Vernet
Administrator
In reply to this post by ChrisSpeare
Chris,

On 8/9/07, ChrisSpeare <[hidden email]> wrote:

> Where shipment and TransportEquipment are both repeating items.  I want to
> set the ContainerType as readonly, but only when its value is NC.  I tried:
>
> <xforms:bind
> nodeset="instance('instance_model_SeaManifest')/ManifestInformation">
>     <xforms:bind nodeset="Shipment">
>         <xforms:bind nodeset="TransportEquipment">
>             <xforms:bind nodeset ="ContainerNumber" readonly="1"
> if="ContainerNumber = 'NC'"/>
>         </xforms:bind>
>     </xforms:bind>
> </xforms:bind>
You want to set the ContainerType as read-only when its value is NC,
so instead of:

<xforms:bind nodeset ="ContainerNumber" readonly="1"
if="ContainerNumber = 'NC'"/>

You should have something like:

<xforms:bind nodeset ="ContainerType" readonly=". = 'NC'"/>

Nodeset has to point to the node on which you want to set the
"read-onlyness", and readonly is an XPath expression that determines
if the node will be read-only or not.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws