Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Select problem

 
Derek Drever
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have the following code:
<script language="Javascript">
function unselectId()
{
document.update.id.options[document.update.id.selectedIndex].selected = false;
}
</script>
<html:select onchange="unselectId()" property="type">
<html ptions collection="Type" property="value" labelProperty="label"/>
</html:select>
<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.
Regards,
Derek.
 
Junilu Lacar
Marshal
Posts: 10385
123
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try setting selectedIndex = -1 instead.
 
Derek Drever
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that and it had no effect, any other ideas gratefully received.
 
Derek Drever
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
disregard the previous comment, it worked, thanks for that.
Regards,
Derek.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!