Best way to handle multiple instances

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

Best way to handle multiple instances

Jeremy Nix
I'm trying to determine the best way of handling instance data that provides basic page state information, but it never submitted.  In my
example below, I have a single model  that contains 3 different instances.  The first 2 instances will need to conform to the model's schema, while the 3rd instance is used mainly for page control logic (adding/deleting nodes, hiding/showing sections, changing colors, etc...).  With the below configuration, I'm not receiving any errors, but technically instance #3 does not conform to the schema. 

<xforms:model id="odm-model" version="1.1" schema="odm1-3-0rev.xsd">
    <xforms:instance id="odm-instance">
        <xi:include href="indata.xml"/>
    </xforms:instance>
    <xforms:instance id="study-def">
        <xi:include href="studydef.xml" xxforms:readonly="true"/>
    </xforms:instance>
    <xforms:instance id="variables-instance">
        <Variables>
            <Status Loading="true"/>
            <DeleteNode />
            <DeleteReason />
            <ActiveNode />
            <HistoryNode />
            <Colors>
                <Color index="1">#FFFF99</Color>
                <Color index="2">#F0E68C</Color>
                <Color index="3">#DDA0DD</Color>
                <Color index="4">#B0E0E6</Color>
                <Color index="5">#DCDCDC</Color>
                <Color index="6">#D2B4BC</Color>
                <Color index="7">#CD853F</Color>
                <Color index="8">#2E8B57</Color>
                <Color index="9">#7FFFD4</Color>
                <Color index="0">#FFDAB9</Color>
            </Colors>
            <Triggers></Triggers>
        </Variables>
    </xforms:instance>
</xforms:model>


The other option is to separate the variables-instance into a separate model.  Yet another option would be to put all three instances in 3 separate models.  Is there any benefits to these approaches such as performance improvements, code simplification, etc...  I do see that its a little more tricky to switch in between models as there is no function model("") that allows you to specify which model to traverse down.

--

Jeremy Nix
Senior Application Developer
Cincinnati Children's Hospital Medical Center


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Best way to handle multiple instances

Alessandro  Vernet
Administrator
Jeremy,

By default Orbeon Forms performs lax validation, so if your UI
instance doesn't have any corresponding definition in the schema, it
will just be "ignored". If you want to make it clear that the UI
instance should not be validated, you can place a
xxforms:validation="skip" on it, and similarly place a
xxforms:validation="strict" on the other instances. You'll find more
on this on:

http://www.orbeon.com/orbeon/doc/reference-xforms-extensions#validation-extensions-schema

There is no model() function, but there is a model attribute you can
use on most XForms elements to switch between models.

Alex

On Wed, Mar 24, 2010 at 7:44 AM, Jeremy Nix <[hidden email]> wrote:

> I'm trying to determine the best way of handling instance data that provides
> basic page state information, but it never submitted.  In my
> example below, I have a single model  that contains 3 different instances.
> The first 2 instances will need to conform to the model's schema, while the
> 3rd instance is used mainly for page control logic (adding/deleting nodes,
> hiding/showing sections, changing colors, etc...).  With the below
> configuration, I'm not receiving any errors, but technically instance #3
> does not conform to the schema.
>
> <xforms:model id="odm-model" version="1.1" schema="odm1-3-0rev.xsd">
>     <xforms:instance id="odm-instance">
>         <xi:include href="indata.xml"/>
>     </xforms:instance>
>     <xforms:instance id="study-def">
>         <xi:include href="studydef.xml" xxforms:readonly="true"/>
>     </xforms:instance>
>     <xforms:instance id="variables-instance">
>         <Variables>
>             <Status Loading="true"/>
>             <DeleteNode />
>             <DeleteReason />
>             <ActiveNode />
>             <HistoryNode />
>             <Colors>
>                 <Color index="1">#FFFF99</Color>
>                 <Color index="2">#F0E68C</Color>
>                 <Color index="3">#DDA0DD</Color>
>                 <Color index="4">#B0E0E6</Color>
>                 <Color index="5">#DCDCDC</Color>
>                 <Color index="6">#D2B4BC</Color>
>                 <Color index="7">#CD853F</Color>
>                 <Color index="8">#2E8B57</Color>
>                 <Color index="9">#7FFFD4</Color>
>                 <Color index="0">#FFDAB9</Color>
>             </Colors>
>             <Triggers></Triggers>
>         </Variables>
>     </xforms:instance>
> </xforms:model>
>
> The other option is to separate the variables-instance into a separate
> model.  Yet another option would be to put all three instances in 3 separate
> models.  Is there any benefits to these approaches such as performance
> improvements, code simplification, etc...  I do see that its a little more
> tricky to switch in between models as there is no function model("") that
> allows you to specify which model to traverse down.
>
> --
> ________________________________
> Jeremy Nix
> Senior Application Developer
> Cincinnati Children's Hospital Medical Center
>
>
> --
> 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet