...

View Full Version : ASP Database Auto Drop Menu Select



mhoque78
12-05-2006, 05:33 PM
Hi

I was wondering if anyone can help me. I am having problem with the ASP script. This is drop down menu script that pulls out from the database. The way this should work is when you select a company and it should select the domain name within the company for example:

When you choose "African Development Bank" company on drop menu should automatic select option "afdb.org" only.

Same goes for the "Allen & Overy" company on the drop menu should automatic select option "allenovery.com", "allenovery.com.uk", "beijing.allenovery.com" and etc.

A Big thanks who ever can solve this!!!!

Here it is email address: mhoque@isda.org (mailto:mhoque@isda.org), please email me the resolved script.

Here is direct link of the output.

http://library.isda.org/isdalib/password2.asp

Here is the script below of the asp file.


<!-- #include file="connectionstring.asp" -->
<!-- METADATA TYPE="typelib"
FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
dim numad
numad = 0
' objects
Set CS = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")

' connection string (info in connectionstring.asp)
CS.ConnectionString = dbasepath
CS.Provider = provider
CS.Open

sql = "SELECT * FROM userlist ORDER BY fullname ASC"

Set RS = CS.Execute(sql)

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Online Library of Interactive ISDA Documentation: Obtain FirmID and Password</title>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><!--#include file="header.inc"--></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><div align="center">
<table width="768" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/big_top.gif" alt="" /></td>
</tr>
<tr>
<td style="background-image:url(images/big_middle.gif)"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<p align="center">&nbsp;</p>

<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td style="background-image:url(images/mptopmiddlebar.jpg)"><div align="left"><img src="images/mptopleftbar.jpg" alt="" /></div></td>
<td style="background-image:url(images/mptopmiddlebar.jpg)"><div align="center"><strong><font color="#FFFFFF">Obtain FirmID and Password</font></strong></div></td>
<td style="background-image:url(images/mptopmiddlebar.jpg)"><div align="right"><img src="images/mptoprightbar.jpg" alt="" width="8" height="20" /></div></td>
</tr>
<tr>
<td colspan="3">

<%
Set CS = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")

' connection string (info in connectionstring.asp)
CS.ConnectionString = dbasepath
CS.Provider = provider
CS.Open

sql = "SELECT * FROM userlist ORDER BY fullname ASC"

Set RS = CS.Execute(sql)


Response.Write "Select Your Company"
Response.Write "<br>"
Response.Write "<select name=company>"
while RS.EOF = false
Response.Write "<option>"
Response.Write " " & RS("fullname") & " "
Response.Write "</option>"
Response.Write "<br>"



RS.MoveNext

wend

Response.Write "</select>"
Response.Write "<br>"


Set RS = CS.Execute(sql)
Response.Write "Select Your Company Email Domain"
Response.Write "<br>"
Response.Write "<select name='Domain'>"

while RS.EOF = false

Response.Write "<option>"
Response.Write " " & RS("domain1") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain2") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain3") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain4") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain5") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain6") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain7") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain8") & " "
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain9") & " "
Response.Write "</option>"
Response.Write "</option>"
Response.Write "<option>"
Response.Write " " & RS("domain10") & " "
Response.Write "</option>"

RS.MoveNext

wend

Response.Write "</select>"
Response.Write "<br>"
Response.Write "</form>"
%>



</td>
</tr>
<tr>
<td colspan="3" style="background-image:url(images/mptopmiddlebar.jpg)">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align="center"></div></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/big_bottom.gif" alt="" /></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><!--#include file="footer.inc"--></td>
</tr>
</table>
</body>
</html>

degsy
12-18-2006, 04:29 PM
What you want is a dependent dropdown.
This means that the second dropdown will depend on the selection of the first.

If you want to do this dynamically then you will have to use Ajax or Javascript
http://forums.aspfree.com/code-bank-54/ajax-asp-dependent-dropdown-137839.html

mhoque78
12-18-2006, 04:36 PM
How do I use dependent dropdown. I don't want to use Ajax, but javascript will be fine. Can you show me or write the script for me how the second dropdown will depend on the first selection.

Thanks

degsy
12-19-2006, 03:36 PM
The script shows how to do it. Even if you don't use the Ajax method then you should still be able to work out how the queries work.

Infact, that script will work using pure HTML & ASP if Javascript is disabled.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum