By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,694 Members | 2,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,694 IT Pros & Developers. It's quick & easy.

Drop Down Menu Question

P: n/a
Hi,
I have a drop down menu that is being populated by a query to the access
database

---- Code ---

Skill needed
<SELECT size="1" NAME="SkillType" VALUE="SkillType">
<OPTION>
<%=SkillType%>
</option>
</select>
<P>
Gender
<select size="1" name="GenderType">
<option>
<%=GenderType%>
</option>
</select>
</P>

Ethnicity
<select size="1" name="EthnicType">
<option>
<%=EthnicType%>
</option>
</select>

---End Code ----

Now when the values are submitted, I use

Request.Form("EthnicType")
Request.Form("GenderType")
Request.Form("SkillType")
to get the values, but all I get is the option number .. like 1 for Male
and 2 for Female in case of Gender Type. How can I make it, where it would
give me Male or Female instead.. that is .. the value that is selected in
the dropdown menu.

If this is not clear then I can post the whole sricpt .. which is not too
big.

Thanks

JB
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
SPA
Normally in the dropdown items, if the value for each item is not specified,
then the index number is taken as its value even if the display text is
different.

Hence if you have
<SELECT size="1" NAME="SkillType">
<OPTION value="<%=SkillType%>">
<%=SkillType%>
</OPTION>
</SELECT>

This will ensure that each Skill item in the drop down has the same value as
the display text - which is what you want :)

HTH
SPA

"Jim Bo" <Yo*******@yahoo.com> wrote in message
news:Xn*******************************@207.69.154. 205...
Hi,
I have a drop down menu that is being populated by a query to the access database

---- Code ---

Skill needed
<SELECT size="1" NAME="SkillType" VALUE="SkillType">
<OPTION>
<%=SkillType%>
</option>
</select>
<P>
Gender
<select size="1" name="GenderType">
<option>
<%=GenderType%>
</option>
</select>
</P>

Ethnicity
<select size="1" name="EthnicType">
<option>
<%=EthnicType%>
</option>
</select>

---End Code ----

Now when the values are submitted, I use

Request.Form("EthnicType")
Request.Form("GenderType")
Request.Form("SkillType")
to get the values, but all I get is the option number .. like 1 for Male
and 2 for Female in case of Gender Type. How can I make it, where it would
give me Male or Female instead.. that is .. the value that is selected in
the dropdown menu.

If this is not clear then I can post the whole sricpt .. which is not too
big.

Thanks

JB

Jul 19 '05 #2

P: n/a
Unfortunately that didn't work. I am still getting the same exact
result... any other suggestions....
JB
"SPA" <sh***********@usswi.com> wrote in
news:#p**************@TK2MSFTNGP09.phx.gbl:
Normally in the dropdown items, if the value for each item is not
specified, then the index number is taken as its value even if the
display text is different.

Hence if you have
<SELECT size="1" NAME="SkillType">
<OPTION value="<%=SkillType%>">
<%=SkillType%>
</OPTION>
</SELECT>

This will ensure that each Skill item in the drop down has the same
value as the display text - which is what you want :)

HTH
SPA

"Jim Bo" <Yo*******@yahoo.com> wrote in message
news:Xn*******************************@207.69.154. 205...
Hi,
I have a drop down menu that is being populated by a query to the

access
database

---- Code ---

Skill needed
<SELECT size="1" NAME="SkillType" VALUE="SkillType">
<OPTION>
<%=SkillType%>
</option>
</select>
<P>
Gender
<select size="1" name="GenderType">
<option>
<%=GenderType%>
</option>
</select>
</P>

Ethnicity
<select size="1" name="EthnicType">
<option>
<%=EthnicType%>
</option>
</select>

---End Code ----

Now when the values are submitted, I use

Request.Form("EthnicType")
Request.Form("GenderType")
Request.Form("SkillType")
to get the values, but all I get is the option number .. like 1 for
Male and 2 for Female in case of Gender Type. How can I make it,
where it would give me Male or Female instead.. that is .. the value
that is selected in the dropdown menu.

If this is not clear then I can post the whole sricpt .. which is not
too big.

Thanks

JB



Jul 19 '05 #3

P: n/a
Then you either didn't do what he suggested, or you aren't telling us
something.
Is SkillType a field in your database, what are it's values?

"Jim Bo" <Yo*******@yahoo.com> wrote in message
news:Xn*******************************@207.69.154. 206...
Unfortunately that didn't work. I am still getting the same exact
result... any other suggestions....
JB
"SPA" <sh***********@usswi.com> wrote in
news:#p**************@TK2MSFTNGP09.phx.gbl:
Normally in the dropdown items, if the value for each item is not
specified, then the index number is taken as its value even if the
display text is different.

Hence if you have
<SELECT size="1" NAME="SkillType">
<OPTION value="<%=SkillType%>">
<%=SkillType%>
</OPTION>
</SELECT>

This will ensure that each Skill item in the drop down has the same
value as the display text - which is what you want :)

HTH
SPA

"Jim Bo" <Yo*******@yahoo.com> wrote in message
news:Xn*******************************@207.69.154. 205...
Hi,
I have a drop down menu that is being populated by a query to the

access
database

---- Code ---

Skill needed
<SELECT size="1" NAME="SkillType" VALUE="SkillType">
<OPTION>
<%=SkillType%>
</option>
</select>
<P>
Gender
<select size="1" name="GenderType">
<option>
<%=GenderType%>
</option>
</select>
</P>

Ethnicity
<select size="1" name="EthnicType">
<option>
<%=EthnicType%>
</option>
</select>

---End Code ----

Now when the values are submitted, I use

Request.Form("EthnicType")
Request.Form("GenderType")
Request.Form("SkillType")
to get the values, but all I get is the option number .. like 1 for
Male and 2 for Female in case of Gender Type. How can I make it,
where it would give me Male or Female instead.. that is .. the value
that is selected in the dropdown menu.

If this is not clear then I can post the whole sricpt .. which is not
too big.

Thanks

JB


Jul 19 '05 #4

P: n/a
Okay.. here is the full script (minus some html crap) that is passing on
the values.. I am still getting the same results..

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<link rel="stylesheet" type="text/css" href="css/styles1.css"/>

</head>
<body>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsSeniors 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less
connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("VolunteerDatabase/volunteersandcitizens.mdb")
'Create an ADO recordset object
Set rsSeniors = Server.CreateObject("ADODB.Recordset")

'THIS CODE IS FOR SKILLS DROP DOWN BOX.
'Initialise the strSQL variable with an SQL statement to query the
database
strSQL ="SELECT TProfiles.lngProfileID, TProfiles.strProfileDescription
FROM TProfiles;"
'Open the recordset with the SQL query
rsSeniors.Open strSQL, adoCon, adOpenKeyset

'loop through the recordset.
DO WHILE NOT rsSeniors.EOF

SkillType = SkillType & "<option value=" & rsSeniors("lngProfileID")
& ">" & rsSeniors("strProfileDescription") & "</option>"
rsSeniors.MoveNext

LOOP
' Close the connection.
rsSeniors.Close
' END OF CODE FOR SKILLS DROP DOWN BOX.


'THIS CODE IS FOR GENDER DROP DOWN BOX.
'Initialise the strSQL variable with an SQL statement to query the
database
strSQL ="SELECT TGenders.lngGenderID, TGenders.strGender from TGenders;"

'Open the recordset with the SQL query
rsSeniors.Open strSQL, adoCon, adOpenKeyset

'loop through the recordset.
DO WHILE NOT rsSeniors.EOF

GenderType = GenderType & "<option value=" & rsSeniors("lngGenderID")
& ">" & rsSeniors("strGender") & "</option>"
rsSeniors.MoveNext

LOOP
' Close the connection.
rsSeniors.Close
' END OF CODE FOR GENDER DROP DOWN BOX.

'THIS CODE IS FOR ETHNIC DROP DOWN BOX.
'Initialise the strSQL variable with an SQL statement to query the
database F
strSQL ="SELECT TEthnicities.lngEthnicityID, TEthnicities.strEthnicity
FROM TEthnicities;"

'Open the recordset with the SQL query
rsSeniors.Open strSQL, adoCon, adOpenKeyset

'loop through the recordset.
DO WHILE NOT rsSeniors.EOF

EthnicType = EthnicType & "<option value=" & rsSeniors
("lngEthnicityID") & ">" & rsSeniors("strEthnicity") & "</option>"
rsSeniors.MoveNext

LOOP
'Reset server objects
rsSeniors.Close
'END OF CODE FOR ETHNIC DROP DOWN BOX.

'THIS CODE IS FOR SENIOR INFORMATION.

lngSeniorInfo = CLng(Request.QueryString("ID"))

'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT TSeniors.* FROM TSeniors WHERE TSeniors.lngSeniorID =" &
lngSeniorInfo & ";"

'Open the recordset with the SQL query
rsSeniors.Open strSQL, adoCon

'END OF CODE FOR SENIOR DETAIL DATA QUERY.

%>

<form method="POST" action="MatchSearchIII.asp">
<table border="1">
<tr>
<td>Full Name</td>
<td><% =rsSeniors("strFirstName") %> &nbsp;
<% =rsSeniors("strMiddleName") %>&nbsp;
<% =rsSeniors("strLastName") %></td>
</tr>

<tr>
<td>Address</td>
<td><% =rsSeniors("strAddress") %></td>
</tr>

<tr>
<td>City</td>
<td></font><% =rsSeniors("strCity") %></td>
</tr>

<tr>
<td>Zip Code</td>
<td><% =rsSeniors("strZipCode") %></td>
</tr>

<tr>
<td>Phone</td>
<td><% =rsSeniors("strPhoneNumber") %></td>
</tr>
</table>

Skill needed
<SELECT size="1" NAME="SkillType">
<OPTION Value="<%=SkillType%>">
<%=SkillType%>
</option>
</select>
<P>
Gender
<select size="1" name="GenderType">
<option value="<%=GenderType%>">
<%=GenderType%>
</option>
</select>
</P>

Ethnicity
<select size="1" name="EthnicType">
<option value="<%=EthnicType%>">
<%=EthnicType%>
</option>
</select>

<Table>

<td height="51" colspan=2><input type="Submit" name="Submit"
value="Find Match"> &nbsp; &nbsp;
<input type="Submit" name="Cancel" value="Cancel">
</td>

</Table>

</form>

<!-- End form code -->
<%
rsSeniors.Close
Set rsSeniors = Nothing 'Nulls the dataset.
Set adoCon = Nothing 'Closes the database connection.
%>

</body>
</html>
Jul 19 '05 #5

P: n/a
> SkillType = SkillType & "<option value=" & rsSeniors("lngProfileID")
& ">" & rsSeniors("strProfileDescription") & "</option>"
Since you're already including the <option> tags in your string, you don't
need to include them further down the page...
<SELECT size="1" NAME="SkillType">
<OPTION Value="<%=SkillType%>">
<%=SkillType%>
</option>
</select>


This should be.....

<SELECT size="1" NAME="SkillType">
<%=SkillType%>
</select>

Then, to display Male or Female instead of 1 and 2, use a Select Case....

Select Case Request.Form("GenderType")
Case 1
GenderType = "Male"
Case 2
GenderType = "Female"
End Select

Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.