/    Sign up×
Community /Pin to ProfileBookmark

linking textboxes to what was picked in a dropdown

Can someone help me figure this out, I do not to Javascript, and someone 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..

<!– #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”>&nbsp;<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>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@timcadieuxauthorMar 29.2003 — From the Recordset (GetRows) 9 & 10 from the Array.

ie. convernors(9,ct) & convernors(10,ct)

Thanx for trying to help ?
Copy linkTweet thisAlerts:
@timcadieuxauthorMar 29.2003 — I'm not sure i know what you mean. I have a database of people's names and their info. I am loading all that info into an array and when someone clicks on the person's name in the dropdown, i just want their phone number and e-mail to appear in the textboxes.
Copy linkTweet thisAlerts:
@timcadieuxauthorMar 29.2003 — I guess so, the DB and everything resides on the Server and the work is being done one the server before being presened to the browser.
Copy linkTweet thisAlerts:
@timcadieuxauthorMar 29.2003 — damn, ok, thanx.
×

Success!

Help @timcadieux spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...