Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending value from dropdown

Status
Not open for further replies.

Annelize

Programmer
Dec 17, 2004
45
GB
Hi

I have a dropdown populated by my recordset. I pass the value of the dropdown to a onchange function using 'this.value'. Is there a way I can send the Name that's displayed to the function instead, WITHOUT assigning it to the value property of the select?

Here is my dropdown
Code:
Response.Write "<td><select id=drpGroup name=drpGroup class=dropdown size=1 onchange=Onchange_Group(this.value);>"

do while not rs2.eof
   Response.Write "<option value=" & rs2("iRoleId") & " selected>" & rs2("vRoleDescription") & "</option>"
   rs2.movenext
loop

and my javascript function
Code:
function Onchange_Group(value)
{
  alert(value);  //this will give me the roleId and not the role description
}

Thanks in advance
 
change your onchange to this

Code:
onChange="this.options[this.selectedIndex].value"

Rob
 
Thanks for the help both of you!

In the end the following worked:
Code:
this.options[this.selectedIndex].[b]text[/b]

A
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top