wood burning stoves 2.0*
The moose likes Struts and the fly likes Select problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Select problem" Watch "Select problem" New topic

Select problem

Derek Drever

Joined: Mar 01, 2002
Posts: 18
I have the following code:
<script language="Javascript">
function unselectId()
document.update.id.options[document.update.id.selectedIndex].selected = false;
<html:select onchange="unselectId()" property="type">
<html ptions collection="Type" property="value" labelProperty="label"/>
<html:select property="id" size="7" >
<html ptions collection="Name" property="value" labelProperty="label"/> </html:select>
I am trying to unselect anything selected on the id list when something is selected on the type list, but the code fails. I would be gratefull for any suggestions.
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4445

try setting selectedIndex = -1 instead.

Junilu - [How to Ask Questions] [How to Answer Questions]
Derek Drever

Joined: Mar 01, 2002
Posts: 18
I tried that and it had no effect, any other ideas gratefully received.
Derek Drever

Joined: Mar 01, 2002
Posts: 18
disregard the previous comment, it worked, thanks for that.
It is sorta covered in the JavaRanch Style Guide.
subject: Select problem
Similar Threads
Validation of Html options
html:options usage
Retaining optionsCollection Values
How to retrieve property and labelProperty info from action class
Please give me what it means..