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

Combo Value and Name

P: n/a
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
Share this Question
Share on Google+
2 Replies

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.