Conditional display based on model

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

Conditional display based on model

Mark Waschkowski
Hi,

I'm trying to figure out a way to conditionally display a part of a
page based on the model. I wasn't sure what to use because nothing
seemed to fit perfectly, but though that switch seemed closest.

So, I did this, and was

<xf:repeat nodeset="instance('searchInstanceResponse')/node">
                <xf:switch ref="property/value[.='false']/../..">
                    <xf:case>

which is weird because its the switch now that is determining what is
displayed, and I have to do the /../.. thing to 'get back' to where I
want to be in the nodeset.

So, I did this instead:

<xf:repeat nodeset="instance('searchInstanceResponse')/node">
                                <xf:group ref="property/value[.='false']/../..">

which is obviously simpler, but seems kinda strange to me to use the
group element for conditional display.

I'm hoping there is a better way...any ideas?

Thanks,

Mark

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Conditional display based on model

Aaron Reed
Hi Mark,

That is one of the main uses of a group, to apply a MIP or a context to
a large number of controls at one time.

You could also do:

<xf:repeat nodeset="instance('searchInstanceResponse')/node">
   <xf:group ref="property/value[.='false']">
     <xf:group ref="../..">


or make a relevancy rule.  But then those parts of the instance data
will not be submitted.

--Aaron

mwaschkowski wrote:

> Hi,
>
> I'm trying to figure out a way to conditionally display a part of a
> page based on the model. I wasn't sure what to use because nothing
> seemed to fit perfectly, but though that switch seemed closest.
>
> So, I did this, and was
>
> <xf:repeat nodeset="instance('searchInstanceResponse')/node">
>                 <xf:switch ref="property/value[.='false']/../..">
>                     <xf:case>
>
> which is weird because its the switch now that is determining what is
> displayed, and I have to do the /../.. thing to 'get back' to where I
> want to be in the nodeset.
>
> So, I did this instead:
>
> <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> <xf:group ref="property/value[.='false']/../..">
>
> which is obviously simpler, but seems kinda strange to me to use the
> group element for conditional display.
>
> I'm hoping there is a better way...any ideas?
>
> Thanks,
>
> Mark
>
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Conditional display based on model

Mark Waschkowski
Still seems strange to me more about the naming than anything I guess
- I don't think of conditional display when using the term 'group' but
I guess that just part of thinking in with these 'X' technologies (ie.
XForms and XPath).

OK, thanks Aaron, appreciate the clarifications, it really helps when
you are just getting going.

Cheers,

Mark

On Apr 13, 3:59 pm, Aaron Reed <[hidden email]> wrote:

> Hi Mark,
>
> That is one of the main uses of a group, to apply a MIP or a context to
> a large number of controls at one time.
>
> You could also do:
>
> <xf:repeat nodeset="instance('searchInstanceResponse')/node">
>    <xf:group ref="property/value[.='false']">
>      <xf:group ref="../..">
>
> or make a relevancy rule.  But then those parts of the instance data
> will not be submitted.
>
> --Aaron
>
> mwaschkowski wrote:
> > Hi,
>
> > I'm trying to figure out a way to conditionally display a part of a
> > page based on the model. I wasn't sure what to use because nothing
> > seemed to fit perfectly, but though that switch seemed closest.
>
> > So, I did this, and was
>
> > <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> >                 <xf:switch ref="property/value[.='false']/../..">
> >                     <xf:case>
>
> > which is weird because its the switch now that is determining what is
> > displayed, and I have to do the /../.. thing to 'get back' to where I
> > want to be in the nodeset.
>
> > So, I did this instead:
>
> > <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> >                            <xf:group ref="property/value[.='false']/../..">
>
> > which is obviously simpler, but seems kinda strange to me to use the
> > group element for conditional display.
>
> > I'm hoping there is a better way...any ideas?
>
> > Thanks,
>
> > Mark


_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: Conditional display based on model

Klotz, Leigh
It doesn't have to be a group; group is kind of like the "null" form
control, if you get my analogy.
It's convenient in that it applies its behavior to all children.
You can do this same thing with nodeset repeat, or ref on input, output,
range, etc.
Leigh.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
mwaschkowski
Sent: Monday, April 16, 2007 5:43 AM
To: [hidden email]
Subject: Re: Conditional display based on model

Still seems strange to me more about the naming than anything I guess
- I don't think of conditional display when using the term 'group' but
I guess that just part of thinking in with these 'X' technologies (ie.
XForms and XPath).

OK, thanks Aaron, appreciate the clarifications, it really helps when
you are just getting going.

Cheers,

Mark

On Apr 13, 3:59 pm, Aaron Reed <[hidden email]> wrote:
> Hi Mark,
>
> That is one of the main uses of a group, to apply a MIP or a context
to

> a large number of controls at one time.
>
> You could also do:
>
> <xf:repeat nodeset="instance('searchInstanceResponse')/node">
>    <xf:group ref="property/value[.='false']">
>      <xf:group ref="../..">
>
> or make a relevancy rule.  But then those parts of the instance data
> will not be submitted.
>
> --Aaron
>
> mwaschkowski wrote:
> > Hi,
>
> > I'm trying to figure out a way to conditionally display a part of a
> > page based on the model. I wasn't sure what to use because nothing
> > seemed to fit perfectly, but though that switch seemed closest.
>
> > So, I did this, and was
>
> > <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> >                 <xf:switch ref="property/value[.='false']/../..">
> >                     <xf:case>
>
> > which is weird because its the switch now that is determining what
is
> > displayed, and I have to do the /../.. thing to 'get back' to where
I
> > want to be in the nodeset.
>
> > So, I did this instead:
>
> > <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> >                            <xf:group
ref="property/value[.='false']/../..">
>
> > which is obviously simpler, but seems kinda strange to me to use the
> > group element for conditional display.
>
> > I'm hoping there is a better way...any ideas?
>
> > Thanks,
>
> > Mark


_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Conditional display based on model

Mark Waschkowski
In reply to this post by Mark Waschkowski
Thanks Leigh, thats a good way to think about it.

My typical use case it to repeat through a bunch of nodes and display
something different depending on the state of the data, like thus:
                Content Tree:
                <xf:repeat nodeset="instance('tree')/node">
                        <xf:group id="displayItem" ref=".[@type='item']">
                                item
                        </xf:group>
                        <xf:group id="displayContainerOpen" ref=".[@type='container']/
displayChildren[.='true']">
                                container, display true
                        </xf:group>
                        <xf:group id="displayContainerClosed" ref=".[@type='container']/
displayChildren[.='false']">
                                container, display false
                        </xf:group>
                </xf:repeat>

As I previously mentioned, seems kinda weird to me to use multiple
groups to distinguish between different model conditions, but I'll get
used to it :)

Mark

On Apr 16, 2:03 pm, "Klotz, Leigh" <[hidden email]> wrote:

> It doesn't have to be a group; group is kind of like the "null" form
> control, if you get my analogy.
> It's convenient in that it applies its behavior to all children.
> You can do this same thing with nodeset repeat, or ref on input, output,
> range, etc.
> Leigh.
>
> -----Original Message-----
> From: [hidden email]
>
> [mailto:[hidden email]] On Behalf Of
> mwaschkowski
> Sent: Monday, April 16, 2007 5:43 AM
> To: [hidden email]
> Subject: Re: Conditional display based on model
>
> Still seems strange to me more about the naming than anything I guess
> - I don't think of conditional display when using the term 'group' but
> I guess that just part of thinking in with these 'X' technologies (ie.
> XForms and XPath).
>
> OK, thanks Aaron, appreciate the clarifications, it really helps when
> you are just getting going.
>
> Cheers,
>
> Mark
>
> On Apr 13, 3:59 pm, Aaron Reed <[hidden email]> wrote:
> > Hi Mark,
>
> > That is one of the main uses of a group, to apply a MIP or a context
> to
> > a large number of controls at one time.
>
> > You could also do:
>
> > <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> >    <xf:group ref="property/value[.='false']">
> >      <xf:group ref="../..">
>
> > or make a relevancy rule.  But then those parts of the instance data
> > will not be submitted.
>
> > --Aaron
>
> > mwaschkowski wrote:
> > > Hi,
>
> > > I'm trying to figure out a way to conditionally display a part of a
> > > page based on the model. I wasn't sure what to use because nothing
> > > seemed to fit perfectly, but though that switch seemed closest.
>
> > > So, I did this, and was
>
> > > <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> > >                 <xf:switch ref="property/value[.='false']/../..">
> > >                     <xf:case>
>
> > > which is weird because its the switch now that is determining what
> is
> > > displayed, and I have to do the /../.. thing to 'get back' to where
> I
> > > want to be in the nodeset.
>
> > > So, I did this instead:
>
> > > <xf:repeat nodeset="instance('searchInstanceResponse')/node">
> > >                            <xf:group
> ref="property/value[.='false']/../..">
>
> > > which is obviously simpler, but seems kinda strange to me to use the
> > > group element for conditional display.
>
> > > I'm hoping there is a better way...any ideas?
>
> > > Thanks,
>
> > > Mark
>
> _______________________________________________
> dev-tech-xforms mailing list
> [hidden email]://lists.mozilla.org/listinfo/dev-tech-xforms


_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: Conditional display based on model

Klotz, Leigh
You're right; it's not great, but it does work and falls out of the
definition.
Some kind of model-based switch is on the books for XForms futures, but
that may be more related to a dymamic switch-like construct than a
conditional display as you have here, so that solution may feel
inexpressive to you too.  But please do track it; you may have some good
input as it develops.

Leigh.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
mwaschkowski
Sent: Tuesday, April 17, 2007 11:14 AM
To: [hidden email]
Subject: Re: Conditional display based on model

Thanks Leigh, thats a good way to think about it.

My typical use case it to repeat through a bunch of nodes and display
something different depending on the state of the data, like thus:
                Content Tree:
                <xf:repeat nodeset="instance('tree')/node">
                        <xf:group id="displayItem"
ref=".[@type='item']">
                                item
                        </xf:group>
                        <xf:group id="displayContainerOpen"
ref=".[@type='container']/
displayChildren[.='true']">
                                container, display true
                        </xf:group>
                        <xf:group id="displayContainerClosed"
ref=".[@type='container']/
displayChildren[.='false']">
                                container, display false
                        </xf:group>
                </xf:repeat>

As I previously mentioned, seems kinda weird to me to use multiple
groups to distinguish between different model conditions, but I'll get
used to it :)

Mark

On Apr 16, 2:03 pm, "Klotz, Leigh" <[hidden email]> wrote:
> It doesn't have to be a group; group is kind of like the "null" form
> control, if you get my analogy.
> It's convenient in that it applies its behavior to all children.
> You can do this same thing with nodeset repeat, or ref on input,
output,
> range, etc.
> Leigh.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms