Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Forms
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2003, 05:07 PM
Authorized User
 
Join Date: Jun 2003
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to rylemer Send a message via MSN to rylemer Send a message via Yahoo to rylemer
Default Update textbox when List menu is Selected in RS

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!!


<%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>
 
Old November 13th, 2003, 10:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
menu items visible always once heading selected. Hughesie78 ASP.NET 2.0 Professional 1 July 17th, 2008 01:22 AM
Selected value from dropdown menu wont display. mizjinx Classic ASP Databases 0 May 20th, 2007 08:24 PM
update list/menu value dynamically anjila Classic ASP Basics 1 February 5th, 2004 05:41 AM
display value of selected radio in the textbox hosefo81 Javascript How-To 1 February 1st, 2004 07:57 AM
Update textbox when List menu is Selected rylemer Javascript 3 November 11th, 2003 10:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.