468,783 Members | 1,640 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,783 developers. It's quick & easy.

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

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.
Jul 19 '05 #1
3 4611
Use client-side code to trigger a reload of the page.

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

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

Ray at work

"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.

Jul 19 '05 #2
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.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eG**************@TK2MSFTNGP11.phx.gbl...
Use client-side code to trigger a reload of the page.

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

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

Ray at work

"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.


Jul 19 '05 #3
<input type="text" value="<%=objRS.Fields.Item(0).Value%>">

Ray at work

"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
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.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eG**************@TK2MSFTNGP11.phx.gbl...
Use client-side code to trigger a reload of the page.

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

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

Ray at work

"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.



Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by rn5a | last post: by
4 posts views Thread by Matthew Cox | last post: by
1 post views Thread by ramya2611 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.