Click to See Complete Forum and Search --> : onchange event


fyanym
04-06-2005, 12:24 AM
table name: personel
ID =1
name = *******
*******************************************************
i have a dropdown list "ID", textbox = "name" when i select "ID" = 1, i want to use a onchange event to display the record "*******" in textbox "name". how do i use vbscript to do this ..., i dont want to use submit method in this case.


my vbscript is like this.....
<%
id=Request.Form("id")

set con=server.CreateObject("ADODB.Connection")
.
.
.

name = rs("name")
.
.
.
%>
:(

buntine
04-06-2005, 12:54 AM
It cannot be done from the client. You will have to send the data to the server for processing. You cannot get data from a database that resides on a server from th clients machine.

The best you can do is have the page submit itself to the server from the JavaScript onchange event.

Regards.

Bullschmidt
04-07-2005, 02:09 AM
Some related links about populating a 2nd listbox based on a change in the 1st listbox but without refreshing the page with a submit:

Cheap Tricks 2: A Dynamically-Linked Listbox
http://www.atgconsulting.com/doublelist.asp
Initially sends all data to the page and then lets JavaScript populate the second list box.
Says it has some unresolved Netscape quirks.
Has demo.
And similar but better one (improved code and 3 select boxes):
Cheap Tricks 4: A Triple-Linked Listbox
http://www.atgconsulting.com/triplelist.asp

Universal Related Popup Menus v 2.02
http://webreference.com/dev/menus/
Initially sends all data to the page and then lets JavaScript populate the second list box.
Has demo.