thriputapriya
07-20-2004, 07:47 AM
HI Antun,
How can i change the default text in second combobox dynamically when i select an item in the first combobox?
I mean, in the below code, when i select the item "asia" from the first combobox and select the item "india" from the second combox,and again select the Europe, the second combobox still show the item "india" instead of showing one of the item under an item "Europe" in the first combobox.
<canvas width="800" height="800" debug="true">
<dataset name="countriesContinents">
<item value="asia" >Asia
<item value="india">India</item>
<item value="japan">Japan</item>
</item>
<item value="europe" >Europe
<item value="italy">Italy</item>
<item value="france">France</item>
</item>
<item value="northAmerica" >North America
<item value="italy">Canada</item>
<item value="france">USA</item>
<item value="france">Mexico</item>
</item>
</dataset>
<combobox x="5" y="5"
width="130"
shownitems="3"
editable="false"
defaulttext="choose one...">
<textlistitem datapath="countriesContinents:/item"
text="$path{'text()'}"
value="$path{'@value'}"/>
<method event="onselect">
Debug.write( "onselect called" );
var dp = "countriesContinents:/item[@value='" + this.value
+ "']";
Debug.write( dp );
countries.setDataPath( dp );
</method>
</combobox>
<combobox name="countries"
datapath=""
x="5" y="30"
width="130"
editable="false"
shownitems="3"
defaulttext="choose one..." >
<textlistitem datapath="item" text="$path{'text()'}"
value="$path{'@value'}"/>
</combobox>
</canvas>
How can i change the default text in second combobox dynamically when i select an item in the first combobox?
I mean, in the below code, when i select the item "asia" from the first combobox and select the item "india" from the second combox,and again select the Europe, the second combobox still show the item "india" instead of showing one of the item under an item "Europe" in the first combobox.
<canvas width="800" height="800" debug="true">
<dataset name="countriesContinents">
<item value="asia" >Asia
<item value="india">India</item>
<item value="japan">Japan</item>
</item>
<item value="europe" >Europe
<item value="italy">Italy</item>
<item value="france">France</item>
</item>
<item value="northAmerica" >North America
<item value="italy">Canada</item>
<item value="france">USA</item>
<item value="france">Mexico</item>
</item>
</dataset>
<combobox x="5" y="5"
width="130"
shownitems="3"
editable="false"
defaulttext="choose one...">
<textlistitem datapath="countriesContinents:/item"
text="$path{'text()'}"
value="$path{'@value'}"/>
<method event="onselect">
Debug.write( "onselect called" );
var dp = "countriesContinents:/item[@value='" + this.value
+ "']";
Debug.write( dp );
countries.setDataPath( dp );
</method>
</combobox>
<combobox name="countries"
datapath=""
x="5" y="30"
width="130"
editable="false"
shownitems="3"
defaulttext="choose one..." >
<textlistitem datapath="item" text="$path{'text()'}"
value="$path{'@value'}"/>
</combobox>
</canvas>