Subject: Update textbox when List menu is Selected in RS
Posted By: rylemer Post Date: 11/10/2003 4:07:51 PM
Hi!
I have a list menu. then I pull the records in one of my table I created I called tblAssign there are 3 Columns in my table. ID, Assign and Email.
What I would like to do is When I selected the records in the list menu the textbox will be updated for ex. when I select "ELmer" in the list Menu the textbox will be shown my email adddres.

here is my codes hope you can help me thanks!!

<!--#include file="datastore.asp"-->
<%Response.buffer=true%>
<%
  Set ObjCommand = Server.CreateObject("ADODB.Command")
  Set ObjCommand.ActiveConnection = ObjConn
      strSQLAssign= "SELECT assign,email from tblAssign Order by assign ASC;"
      ObjCommand.CommandText = strSQLAssign
  Set objRSt = ObjCommand.Execute
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="javascript">
    function PutEmail(objThis){
        document.form1.txtEmail.value = document.form1.assign.sourceIndex(2);
    }
</script>
<body>
<form name="form1" method="post" action="">
  <select name="assign" size="1" OnChange=PutEmail(this);>
          <option><%=strassigned%></option>
          <%
               While not objRSt.EOF
                Response.Write "<option " & objRSt("email") & ">" & objRSt("assign") & "</option>" & "<br>"
                objRSt.MoveNext
            Wend
                objRSt.Close
             set objRSt = Nothing
          %>
   </select>
  <input name="txtEmail" type="text" id="txtEmail">
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
Reply By: KenSchaefer Reply Date: 11/13/2003 9:28:00 PM
Unless you store all the possible items in some kind of client-side array, you will need to post the form back to the server whenever the select list changes, and do a lookup for that record.

Cheers
Ken

Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com

Go to topic 6028

Return to index page 1006
Return to index page 1005
Return to index page 1004
Return to index page 1003
Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997