- From: Aaron Reed <aaronr@us.ibm.com>
- Date: Wed, 02 Aug 2006 18:58:23 -0500
- To: www-forms@w3.org
Hi Oliver,
Here is another example that does what I think you want.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title>Dependent Select1 testcase</title>
<xf:model>
<xf:instance id="data" xmlns="">
<data>
<country/>
<city/>
<hotel/>
</data>
</xf:instance>
<!-- Country list -->
<xf:instance id="countries">
<countries xmlns="">
<country>Denmark</country>
<country>France</country>
<country>Germany</country>
<country>Holland</country>
</countries>
</xf:instance>
<!-- Hotel list -->
<xf:instance id="hotels">
<hotels xmlns="">
<country>
<name>Denmark</name>
<city>
<name>Copenhagen</name>
<hotel>Little Mermaid Inn</hotel>
<hotel>Nyhavn Hotel</hotel>
</city>
<city>
<name>Ã…lborg</name>
<hotel>Skipper Hotel</hotel>
<hotel>Smugkroen</hotel>
</city>
</country>
<country>
<name>France</name>
<city>
<name>Paris</name>
<hotel>L'Hotel de la Tour Eiffel</hotel>
<hotel>Le Ptit Coin</hotel>
</city>
</country>
<country>
<name>Germany</name>
<city>
<name>Düsseldorf</name>
<hotel>Schnurbart Imbiss</hotel>
<hotel>Bremer Hotel</hotel>
</city>
</country>
<country>
<name>Holland</name>
<city>
<name>Amsterdam</name>
<hotel>The Red Tulip</hotel>
<hotel>Dam Superior</hotel>
</city>
<city>
<name>Den Haag</name>
<hotel>DH Superior</hotel>
<hotel>Canal Suites</hotel>
</city>
</country>
</hotels>
</xf:instance>
<xf:bind nodeset="city"
relevant="string-length(string(../country)) > 0"/>
<xf:bind nodeset="hotel" relevant="string-length(string(../city))
> 0"/>
</xf:model>
</head>
<body>
<h2>Select1 for city should only appear if country has been set.
Select1
for hotel should only appear if city has been set.
</h2>
<xf:group>
<xf:select1 ref="country">
<xf:label>Country: </xf:label>
<xf:itemset nodeset="instance('hotels')/country">
<xf:label ref="name"/>
<xf:value ref="name"/>
</xf:itemset>
<xf:setvalue ref="../city" value="" ev:event="xforms-select"/>
<xf:setvalue ref="../hotel" value="" ev:event="xforms-select"/>
</xf:select1>
<xf:select1 ref="city">
<xf:label>City: </xf:label>
<xf:itemset nodeset="instance('hotels')/country[name =
instance('data')/country]/city">
<xf:label ref="name"/>
<xf:value ref="name"/>
</xf:itemset>
<xf:setvalue ref="../hotel" value="" ev:event="xforms-select"/>
</xf:select1>
<xf:select1 ref="hotel">
<xf:label>Hotel: </xf:label>
<xf:itemset nodeset="instance('hotels')/country[name =
instance('data')/country]/city[name = instance('data')/city]/hotel">
<xf:label ref="." />
<xf:value ref="."/>
</xf:itemset>
</xf:select1>
</xf:group>
</body>
</html>
Let me know if you have any questions/problems with it.
--Aaron
Oliver Rath wrote:
> For testing some selecting case for big data volume im looking for some
> running example for a nested select1-control.
>
> Unfortunatly all my tests failed up to this moment. :-(
>
> The idea:
>
> My first select1-pulldown:
>
> color
> car
> time
>
>
> should generate a second select1-control (maybe in the same row?) with
> some different items, i.e.
>
> for color:
>
> red
> green
> blue
>
> for car:
>
> bmw
> audi
> toyota
>
> for time:
>
> tomorrow
> yesterday
> today
>
> which toggles dynamicly depending on the first select1-control.
> What is the appropriate technique for this?
>
> Nested cases with toggles?
> events (how to do this)?
> triggering?
>
> Unfortunatly Im a bit confused at the moment, because _nothing_ works
> really in the wanted way above.
>
> Im running firefox 1.5.0.4 with xforms 0.6 plugin.
>
>
> Thanks for help in advance!
>
> Oliver
>
>
>
>
Received on Thursday, 3 August 2006 00:16:28 UTC