select ID in drop down list and show name in text box without clicking submit button

M

Matthew Louden

if the user select the EmployeeID in drop down list, and then click the
submit button, and it will look up database and show the Employee Name in
the text box, this is easy.

But my case is: when the user select the employeeid in drop down list, it
will
fire the onchange event, and then look up database and show the employee
name in the text box. There is no submit button.

I really have no idea how to do that.
 
R

Ray at

Use client-side code to trigger a reload of the page.

<select onchange="location.href='thispage.asp?id='+this.value">


<%

Dim iSelectedID, sName
iSelectedID = Request.Querystring("id")
If iSelectedID <> "" Then
sSQL = "SELECT theName FROM theTable WHERE theID=" & iSelectedID"
'etc.
%>

Ray at work
 
M

Matthew Louden

Thanks Ray, Now I am able to get the name corresponding to the id selected
by the user.

But now to put the name printed in the text box? the following is javascript
again, and I put inside <% %> and it wont work.

document.eventform.empname.value = objRS("FirstName")


please help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top