473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Drop Down Menu Question

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
5 5858
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
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
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
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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: KK | last post by:
Drop-down menus are the hottest thing since Wonder Bread but . . . 1. Alot of people put them in the they-look-nice-but-you-cant-code-them-right-so-they-always-look-messed-up category (a la...
6
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens...
0
by: vikram.cvk | last post by:
Hello Experts, Im trying to design a CSS vertical drop down menu which should have the following functionality. Home About Us | -->Overview
4
by: simon.cigoj | last post by:
I have an javascript made menu and some forms with the dropdown element. When the menu opens and scrolls down the drop down is displeyed over the menu and obscures the menu choices. I have this...
3
by: phil | last post by:
We are developing specs. for a website for a nonprofit org, with database for membership related functions. But..question is regarding drop down menu links. We will have 20 category-pages, and...
17
by: Aussie Rules | last post by:
Hi, I want to have a single line combo box dropdown, but where i can selected multiple items in the drop down via a check box... I can see one in the standard tool box... is there one ? If...
1
by: phpnewb | last post by:
Hi, I know i'm doing it wrong, but I'm using a while loop right now to create several instances of a drop down menu. It gives me undesirable results. Can you tell me the right way to do it. Below are...
6
by: mcgrew.michael | last post by:
I hope this is the right group. I am very new to ASP so this is probably a stupid question. I have some vbscript that query's AD and populates a recordset. I know the recorset contains the...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
2
by: laredotornado | last post by:
Hi, If any of you have a Google home page ... http://www.google.com/ig you'll notice that when you click on the drop down arrow graphic for each module, there is a drop down menu that appears....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.