You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Madel,Kurt" <km...@csmi.com> on 2002/10/03 20:13:39 UTC

Multiple selected for html:select

I have two collections, 1 is of managers that need to be preselected and the
other is managers that can be selected from.  Here is my jsp code:

<html:select property="managers[0].id"  size="4" multiple="true" >
	<html:options collection="managerList" property="person_id"
labelProperty="person.name" />
</html:select>

'managers' is a Vector in a DynaActionForm, and managerList is of type List,
not sure if this matter. However, this works, but obviously only creates 1
selected option, as seen below: 

<select name="managers[0].id" multiple="multiple" size="4">
	<option value="266">Gurpreet Singh</option>
	<option value="267">James Eberhardt</option>
	<option value="268">John Fairbanks</option>
	<option value="269">Kevin Stork</option>
	<option value="277">Steve Goguen</option>
	<option value="365" selected="selected">Susan Rogers</option>
</select>

What I want is for multiple managers to be selected, as below: 

<select name="managers[0].id" multiple="multiple" size="4">
	<option value="266">Gurpreet Singh</option>
	<option value="267">James Eberhardt</option>
	<option value="268">John Fairbanks</option>
	<option value="269" selected="selected">>Kevin Stork</option>
	<option value="365" selected="selected">Susan Rogers</option>
</select>
	
Note, the bottom two are selected.  What do I put in the <html:select> to
make this work?

Thanks,

Kurt Madel
Programmer, CSMi
(703) 823-4300 ext. 170



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>