I solved this, not sure if it is good practice, but this might be useful to
others.

Below you will see that I am working with the managers Vector that contains
Person objects.  I changed the select part to:

<html:select property="managers"  size="4" multiple="true" >

And, added the following to my Person class:

public String toString()
    {
        return _id.toString();
    }

Person.id is what I want to compare to managerList.person_id, and this
works!   managers is still a Vector in a DynaActionForm.  Finally, I am
starting to pick this stuff up.

-----Original Message-----
From: Madel,Kurt [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 03, 2002 2:14 PM
To: '[EMAIL PROTECTED]'
Subject: 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:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to