- From: Swithun Crowe <swithun@swithun.servebeer.com>
- Date: Mon, 6 Jun 2005 17:52:29 +0100 (BST)
- To: Jonathan Curtis <Jonathan.Curtis@sesame.co.uk>
- cc: www-forms@w3.org
Hello You just need to AND them: instance('form_data')/select/item[ (position() != 3 or instance('inst')/firstval = 1) AND (position() != 1 or instance('inst')/anotherval = 2) ] ((not X) or Y) is the same as (if X then Y) and conditionals succeed whenever the antecedent is false or the conclusion true. Swithun. On Mon, 6 Jun 2005, Jonathan Curtis wrote: > Thanks again for the help. Much appreciated. > > On that w3 spec page, on the table it says "The form control (and any children) must be hidden or unavailable to the user. Entering a value or obtaining focus should not be allowed.". I would've thought that applied to items of select. > > Going back to your suggestion of > > instance('form_data')/select/item[position() != 3 or instance('inst') = 1] > How could I incorporate that into the situation where I also need another item in the select to be hidden/shown depending on a different value? So, for example, how could this: > > instance('form_data')/select/item[position() != 1 or instance('inst')/anotherval = 2] > > be combined with the one above? > > Thanks > > Jon > > -----Original Message----- > From: Swithun Crowe [mailto:swithun@swithun.servebeer.com] > Sent: 06 June 2005 17:03 > To: Jonathan Curtis > Cc: www-forms@w3.org > Subject: RE: Hide/show select options > > > Hello > > Relevance is to do with submission. If a node evaluates as not being > relevant, then it won't get submitted. But the spec' and implementations > are vague about what happens prior to submission. > > It is all here: > http://www.w3.org/TR/2003/REC-xforms-20031014/slice6.html#model-prop-relevant > > formsPlayer uses CSS to hide irrelevant UI controls but the usual > > *.disabled { > display: none; > } > > doesn't seem to work for itemset items, so you may have to take your pick > from the inelegant solutions. > > Swithun. > > > On Mon, 6 Jun 2005, Jonathan Curtis wrote: > > > Thanks Swithun. I don't really like the idea of having to force the form to rebuild though. I like things to just 'work' :) > > > > I have come up with this solution (below), which works. I believe my > original suggestion should work. Perhaps a bug with implementations? Or > maybe relevant not supposed to be used in this way. I was under the > impression that when a node was not relevant, it is effectively removed > from the instance. This can't be happening though, else the first way > would work. > > > > If anyone had a better way, or explaination why my first idea doesn't work, I'd love to hear. > > > > Jon > > > > <html xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> > > <head> > > <title>Test XForm</title> > > <xf:model> > > <xf:instance id="inst"> > > <test>1</test> > > </xf:instance> > > <xf:instance id="form_data"> > > <form_data> > > <test>1</test> > > <select> > > <value>1</value> > > <item relevant="true"> > > <label>one</label> > > <value>1</value> > > </item> > > <item relevant="true"> > > <label>two</label> > > <value>2</value> > > </item> > > <item relevant="true"> > > <label>three</label> > > <value>3</value> > > </item> > > </select> > > </form_data> > > </xf:instance> > > <xf:bind id="test" nodeset="/test"/> > > <xf:bind id="select" nodeset="instance('form_data')/select/value"/> > > <xf:bind nodeset="instance('form_data')/select/item[3]/@relevant" calculate="instance('inst') = 1"/> > > </xf:model> > > </head> > > <body> > > <xf:input bind="test"> > > <xf:label>test</xf:label> > > </xf:input> > > <xf:select1 bind="select"> > > <xf:label>Select</xf:label> > > <xf:itemset nodeset="instance('form_data')/select/item[@relevant = 'true']"> > > <xf:label ref="label"/> > > <xf:value ref="value"/> > > </xf:itemset> > > </xf:select1> > > </body> > > </html> > > > > ________________________________________________________________________ > > This e-mail has been scanned for all viruses by Star. The > > service is powered by MessageLabs. For more information on a proactive > > anti-virus service working around the clock, around the globe, visit: > > http://www.star.net.uk > > ________________________________________________________________________ > > > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ >
Received on Monday, 6 June 2005 16:53:00 UTC