I'm unable to show and hide a button within a repeat, based on the
value of an attribute. I've tried a bind to the attribute that
determines relevancy, but that makes the button appear or not appear in
every row. It seems there is no "if" attribute I can use. How do
I make the button show only when the current iteration of a
repeat has an attribute with a particular value?
Thanks, -Jim -- 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 |
Administrator
|
You could do something like this:
<xforms:trigger ref="for $position in position() return .[$position = 12]"> With recent builds, you can also use variables: <xxforms:variable name="position" select="position()"/> <xforms:trigger ref=".[$position = 12]"> -Erik On Jun 2, 2008, at 8:25 PM, Jim Logan wrote: > I'm unable to show and hide a button within a repeat, based on the > value of an attribute. I've tried a bind to the attribute that > determines relevancy, but that makes the button appear or not appear > in every row. It seems there is no "if" attribute I can use. How do > I make the button show only when the current iteration of a repeat > has an attribute with a particular value? > > Thanks, > -Jim > > > -- > 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 for the Enterprise Done the Right Way 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
You could do something like this:Hi Erik, Thanks, somehow I missed that a trigger is allowed to have a ref. I got it working with ref=".[@action = 'create']". I'm not sure why the following bind is any different, though. Could you explain please? <xforms:bind id="deletable-version" nodeset="instance('asset-instance')/v:Data_asset/v:has_version/v:Data_asset_version/@action" relevant=".='create'" /> I still have a question about your XPath expression above. I've seen this pattern before somewhere, and I don't understand why the loop is necessary. It looks like it is looping only once and returning a node only if it's the 12th row, otherwise it returns an empty node set. Why can't you just use ".[position() = 12]"? What role does the loop play? Thanks, -Jim -- 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 |
Administrator
|
Jim,
On Tue, Jun 3, 2008 at 7:45 AM, Jim Logan <[hidden email]> wrote: > I still have a question about your XPath expression above. I've seen this > pattern before somewhere, and I don't understand why the loop is necessary. > It looks like it is looping only once and returning a node only if it's the > 12th row, otherwise it returns an empty node set. Why can't you just use > ".[position() = 12]"? What role does the loop play? The loop doesn't really "loop", it is just used here to declare a variable $position (if only "let" was also available in XPath 2.0). You need to do this because you need position() to be evaluated outside of the predicate. Inside the predicate, the context changes and position() is always 1 (so .[position() = 12] would always be empty). Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ 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 |
In reply to this post by Erik Bruchez
Hi, I've got some code that generates an xml instance containing information about the Vlans we have configured on our network. The instance is generated from a back end sql database and is of the form <vlans> <vlan> <vlanid> <buildingid> <some other element> <.... </vlan> <vlan> .... </vlan> etc </vlans> I'm currently displaying all of the information for each vlan. What I'd like to do is have a hide/display control so that by default I'd have display only the vlanid and building id to start with with a hide/display control next to it that would hide/display all the other elements in the <vlan> object Can someone pint me at some info as to how to do this? TIA 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Briefly: use xforms:trigger, an xforms:toggle action, and
xforms:switch/xforms:case. -Erik On Jul 7, 2008, at 7:56 AM, Alex Sharaz wrote: > > Hi, > I've got some code that generates an xml instance containing > information about the Vlans we have configured on our network. The > instance is generated from a back end sql database and is of the form > > <vlans> > <vlan> > <vlanid> > <buildingid> > <some other element> > <.... > </vlan> > <vlan> > .... > </vlan> > etc > </vlans> > > I'm currently displaying all of the information for each vlan. > What I'd like to do is have a hide/display control so that by > default I'd have display only the vlanid and building id to start > with with a hide/display control next to it that would hide/display > all the other elements in the <vlan> object > > Can someone pint me at some info as to how to do this? > > TIA > 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 > OW2 mailing lists service home page: http://www.ow2.org/wws Orbeon Forms - Web Forms for the Enterprise Done the Right Way 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |