VB / SQL Help ... Populate text box

santana9

Banned
Jan 19, 2003
154
0
0
Ok, I have a drop down list that is populated with the client's first and last name from the database. What I want is to have the preceding text box's such as their title, email, address, etc. (other columns in the table) to change when a user selects the approriate name.

I am able to get the client information to work, but am unable to change the info. Here is my some of the code:

strSQL3= "Select * from Client where Client.Last_Name like '%" & url & "%'"

<SCRIPT LANGUAGE="JavaScript">
<!--
function menu_goto(menuform)
{
selecteditem = menuform.requested_by.selectedIndex;
url = menuform.requested_by.options[selecteditem].value;
if (url.length != 0)
{
location.href = url;
}
}

//-->
</SCRIPT>

<SELECT size=1 name=requested_by onchange="menu_goto(this.form)">
<%
rstSearch2.Open strSQL2, Conn, adOpenKeyset, adLockOptimistic, adCmdText
do while not rstSearch2.EOF
%>
<option><%=rstsearch2.fields("LAST_NAME").value%></option>
<%rstSearch2.movenext
loop
rstSearch2.close
set rstSearch2 = nothing
response.flush
%>

<INPUT type="text" name=ctitle value="<%= Server.HTMLEncode(rstSearch3.Fields("ctitle").Value) %>" size="25">

LMK if you need any more information. Thanks in advance.
 

GilletteCat

Member
Dec 28, 2001
181
0
0
First of all, to be able to read .value property of a selected index it has to exist!!! :)
Look carefully at your <option> tag, THERE IS NO value specified. You'd have to have: <option value="<%=rstsearch2("TITLE") & ", " & rstsearch2("EMAIL") & ", " & rstsearch2("ADDRESS")%>"><%=rstsearch2.fields("LAST_NAME").value%></option>
Good luck