struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anja Friedrichsen <af...@ebi.ac.uk>
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

    alert(options);

after
    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
>map.
>
>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 [mailto:afrie@ebi.ac.uk] 
>Sent: 06 April 2005 11:20
>To: Struts Users Mailing List
>Subject: change selected item in drop down list
>
>Hi!
>
>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!
>
>Anja
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message