tcadieux
03-31-2003, 05:49 PM
Can someone help me figure this out, I do not to Javascript, but some kind
soul gave me this primer on how to populate Textboxes depending on what
someone picks from a dropdown. It works but the example only had 1 textbox
being populated, i would like to do 2 more, but I do not know how. My code
is below..I want to be able to put the person's e-mail and phone number in
the two other textboxes, assume they are in position 3 and 4 in the array.
<!-- #include file="../includes/adovbs.inc" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head> <script language="javascript">
<!--
function SetConvenor (o)
{
if (document.info.Convenor.selectedIndex > 0)
o.value =
document.info.Convenor.options[document.info.Convenor.selectedIndex].value;
}
//}
//-->
</script>
</head>
<body>
</body>
</html>
<%
strDBPath = Server.MapPath("admin/registration.mdb")
Set cnnGetRows = Server.CreateObject("ADODB.Connection")
cnnGetRows.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
& ";"
strSQL = "SELECT convenor.ConvenorID, convenor.c_lname, convenor.c_fname,
convenor.c_hphone, " strSQL = strSQL & "convenor.c_wphone, prov.Province,
convenor.c_email, prov.ProvID " strSQL = strSQL & "FROM convenor INNER JOIN
prov ON convenor.ProvID = prov.ProvID " strSQL = strSQL & "WHERE
prov.ProvID=" & request.QueryString("provID") & ";"
Set rs = cnnGetRows.Execute(strSQL)
if not rs.eof then
convernors = rs.GetRows()
end if
rs.Close
Set rs = Nothing
cnnGetRows.Close
Set cnnGetRows = Nothing
%>
<FORM action="test.asp" method=post name="info">
<table>
<tr>
<td><font size="2" face="Arial"> <b>Convenor:</b></font></td>
</tr>
<tr>
<td><font size="+0" face="Arial">
<input NAME="convenor_name" SIZE="2" MAXLENGTH ="2" readonly> <br> <input
NAME="convenor_e-mail" SIZE="2" MAXLENGTH ="2" readonly> <br> <input
NAME="convenor_phone" SIZE="2" MAXLENGTH ="2" readonly> <br>
<select onfocusout="return
Convenor_onfocusout()" name="Convenor" size="1" tabindex ="7"
onchange="SetConvenor (document.info.convenor_name);">
<option value=" " selected>Convenor Name...</option>
<% if isarray(convernors) then
for ct=0 to ubound(convernors,2) %>
<option value="<%=convernors(0,ct)%>"
<%if trim(convernors(0,ct))=trim(Session("Convenor")) then
Response.Write "selected"%>><%= convernors(2,ct) & " " & convernors(1,ct)
%></option>
<% Next
end if
%>
</select></font></td>
</tr>
</table>
soul gave me this primer on how to populate Textboxes depending on what
someone picks from a dropdown. It works but the example only had 1 textbox
being populated, i would like to do 2 more, but I do not know how. My code
is below..I want to be able to put the person's e-mail and phone number in
the two other textboxes, assume they are in position 3 and 4 in the array.
<!-- #include file="../includes/adovbs.inc" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head> <script language="javascript">
<!--
function SetConvenor (o)
{
if (document.info.Convenor.selectedIndex > 0)
o.value =
document.info.Convenor.options[document.info.Convenor.selectedIndex].value;
}
//}
//-->
</script>
</head>
<body>
</body>
</html>
<%
strDBPath = Server.MapPath("admin/registration.mdb")
Set cnnGetRows = Server.CreateObject("ADODB.Connection")
cnnGetRows.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
& ";"
strSQL = "SELECT convenor.ConvenorID, convenor.c_lname, convenor.c_fname,
convenor.c_hphone, " strSQL = strSQL & "convenor.c_wphone, prov.Province,
convenor.c_email, prov.ProvID " strSQL = strSQL & "FROM convenor INNER JOIN
prov ON convenor.ProvID = prov.ProvID " strSQL = strSQL & "WHERE
prov.ProvID=" & request.QueryString("provID") & ";"
Set rs = cnnGetRows.Execute(strSQL)
if not rs.eof then
convernors = rs.GetRows()
end if
rs.Close
Set rs = Nothing
cnnGetRows.Close
Set cnnGetRows = Nothing
%>
<FORM action="test.asp" method=post name="info">
<table>
<tr>
<td><font size="2" face="Arial"> <b>Convenor:</b></font></td>
</tr>
<tr>
<td><font size="+0" face="Arial">
<input NAME="convenor_name" SIZE="2" MAXLENGTH ="2" readonly> <br> <input
NAME="convenor_e-mail" SIZE="2" MAXLENGTH ="2" readonly> <br> <input
NAME="convenor_phone" SIZE="2" MAXLENGTH ="2" readonly> <br>
<select onfocusout="return
Convenor_onfocusout()" name="Convenor" size="1" tabindex ="7"
onchange="SetConvenor (document.info.convenor_name);">
<option value=" " selected>Convenor Name...</option>
<% if isarray(convernors) then
for ct=0 to ubound(convernors,2) %>
<option value="<%=convernors(0,ct)%>"
<%if trim(convernors(0,ct))=trim(Session("Convenor")) then
Response.Write "selected"%>><%= convernors(2,ct) & " " & convernors(1,ct)
%></option>
<% Next
end if
%>
</select></font></td>
</tr>
</table>