473,408 Members | 1,904 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,408 software developers and data experts.

Combo Value and Name

If I click the "Update" button on my form below, I can retrieve the value of
my combo by using code in the FORM RESULTS section below. Therefore, if I
choose the "Inside" option in my combo, I would get "1" as the value of my
combo box.

Is there any way to retrieve the Name associated with the value? So not only
retrieve the combo value of 1, but also retrieve the name "Inside" after
submitting my form?

FORM RESULTS **********************

cboMachineArea=Request.Form("cboMachineArea")
FORM CODE ************************

<form name="DataForm" method=post action="form_test.asp">

<font face="Verdana,sans-serif" size="2">Name</font><br>

<input type="textbox" size=30 name="Full Name" value="My Test Name"><br>
<font face="Verdana,sans-serif" size="2">Area</font><br>
<select name="cboArea" id="cboArea">
<OPTION value="1" selected>Inside</option>
<OPTION value="2">Outside</option>
</select>

<br>
<input type=submit name="DataFormSubmit" value="Update">
</form>

Aug 25 '06 #1
2 2750
No, browser don't post that data back to the server. Either look the text
value back up from the same source you used to generate the dropdown box in
the first page, or include the text value in the option value and parse it
out.

<select name="cboArea">
<option value="1,Inside">1</option>
<option value="2,Outside">2</option>
</select>
<%

Dim aParts
aParts = Split(Request.Form("cboArea"), ",")

Response.Write "ID value = " & aParts(0) & "<hr>"
Response.Write "Text value = " & aParts(1)

%>

Ray at work
"Scott" <sb*****@mileslumber.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
If I click the "Update" button on my form below, I can retrieve the value
of my combo by using code in the FORM RESULTS section below. Therefore, if
I choose the "Inside" option in my combo, I would get "1" as the value of
my combo box.

Is there any way to retrieve the Name associated with the value? So not
only retrieve the combo value of 1, but also retrieve the name "Inside"
after submitting my form?

FORM RESULTS **********************

cboMachineArea=Request.Form("cboMachineArea")
FORM CODE ************************

<form name="DataForm" method=post action="form_test.asp">

<font face="Verdana,sans-serif" size="2">Name</font><br>

<input type="textbox" size=30 name="Full Name" value="My Test Name"><br>
<font face="Verdana,sans-serif" size="2">Area</font><br>
<select name="cboArea" id="cboArea">
<OPTION value="1" selected>Inside</option>
<OPTION value="2">Outside</option>
</select>

<br>
<input type=submit name="DataFormSubmit" value="Update">
</form>

Aug 25 '06 #2
Or, if that really is the select group's options and ithey will never
change, drop the value altogether. It doesn't seem to serve any
purpose in this example:

<select name="cboArea">
<option>Inside</option>
<option>Outside</option>
</select>

Ray's suggestions are the best option (no pun intended) for lists that
may change or ones that are generated dynamically.

--
Mike Brind

Ray Costanzo [MVP] wrote:
No, browser don't post that data back to the server. Either look the text
value back up from the same source you used to generate the dropdown box in
the first page, or include the text value in the option value and parse it
out.

<select name="cboArea">
<option value="1,Inside">1</option>
<option value="2,Outside">2</option>
</select>
<%

Dim aParts
aParts = Split(Request.Form("cboArea"), ",")

Response.Write "ID value = " & aParts(0) & "<hr>"
Response.Write "Text value = " & aParts(1)

%>

Ray at work
"Scott" <sb*****@mileslumber.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
If I click the "Update" button on my form below, I can retrieve the value
of my combo by using code in the FORM RESULTS section below. Therefore, if
I choose the "Inside" option in my combo, I would get "1" as the value of
my combo box.

Is there any way to retrieve the Name associated with the value? So not
only retrieve the combo value of 1, but also retrieve the name "Inside"
after submitting my form?

FORM RESULTS **********************

cboMachineArea=Request.Form("cboMachineArea")
FORM CODE ************************

<form name="DataForm" method=post action="form_test.asp">

<font face="Verdana,sans-serif" size="2">Name</font><br>

<input type="textbox" size=30 name="Full Name" value="My Test Name"><br>
<font face="Verdana,sans-serif" size="2">Area</font><br>
<select name="cboArea" id="cboArea">
<OPTION value="1" selected>Inside</option>
<OPTION value="2">Outside</option>
</select>

<br>
<input type=submit name="DataFormSubmit" value="Update">
</form>

Aug 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
1
by: Will | last post by:
I have a combo box on a form which is based on table tblMachine. On that combo box I have four columns visible MachineNumber, description, location and type. The bound column is the MachineNumber...
1
by: meganrobertson22 | last post by:
Hi Everyone- I am trying to use a simple macro to set the value of a combo box on a form, and I can't get it to work. I have a macro with 2 actions: OpenForm and SetValue. I can open my form,...
8
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
8
by: AA Arens | last post by:
Hi I do have a products table and products-parts table in my Access 2003 database and log all services into a form. I do have at least the following two combo boxes on my form: - Choose...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
1
by: ecce66 | last post by:
i'm trying to make a very simple combo box which will act as a shopping cart for my website where i will be selling some art prints; ideally once a visitor selects a print title in the combo box,...
30
ADezii
by: ADezii | last post by:
This week’s Tip of the Week will clearly demonstrate how you can dynamically set the Drop Down List Width of a Combo Box to the length of the longest item in its Row Source. The inspiration for this...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.