struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anja Friedrichsen <>
Subject Re: change selected item in drop down list
Date Wed, 06 Apr 2005 15:23:33 GMT
Thanks for your answer Mark,

I am new with JavaScripts and I tried your example, but it does not 
really work...

I tried to do


    var options = form.elements['select'].options[i];

but nothing happend. What exactly is that line doing?

Thanks, Anja

Mark Benussi wrote:

>Yes you can select an option in a selection, but you would need to know the
>index of the option.
>form.elements['select'].options[i].selected = true;
>When generating the select using the html:options argument your presentation
>layer wont have much knowledge of the data passed so you will have to
>recurse the options until you find one that matches your selection on the
>function somethingHappened(mapSelection) {
>	var options = form.elements['select'].options[i];
>	for(var i = 0; i < options.length; i++) {
>		var option = options[i];
>		if(option.value == mapSelection) {
>			option.selected = true;
>			break;
>		}
>	}	
>-----Original Message-----
>From: Anja Friedrichsen [] 
>Sent: 06 April 2005 11:20
>To: Struts Users Mailing List
>Subject: change selected item in drop down list
>My application is based on stuts and contains among other thing a 
>dropdown list and a graph. What I want to do, is to change the selected 
>item in the drop down list, when clicking on the corresponding node in 
>the graph.
>Is it possible to change the selected item in a dropdown list?
>My drop down list looks like that:
>                      <html:select property="cvIdentification">
>                          <html:options collection="cvIdentifications" 
>property="shortlabel" labelProperty="shortlabel" />
>                      </html:select>
>Thanks in advanced!
>To unsubscribe, e-mail:
>For additional commands, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message