br*******@gmail .com wrote:
There must be a way.
I'm making a selection from a drop-down list that had an ID number as
the value and displays a text field. After submitting the data to the
database I am sending an email and would like to include the value
displayed in the DD box, not the hidden value. How so I reference that
displayed value?
<select name="select">
<option value="1">Blue</option>
<option value="2">Red</option>
<option value="3">Green </option>
</select>
I want to use the number for the database but display the words in the
confirmation email. Is thsi possible without making another roundtrip
to the database?
I assume you are talking about doing this in server-side code. If so, there
is really no way to directly read the display value from the Request: only
the values are sent via Request which you have already discovered.
Yes, you could make another trip to the database to retrieve the value, but
that really is not necessary. There are several options:
1. Use client-side code to store the text of the selected option in a hidden
field.
2. You could store the value-text list used to create the options in a
session variable, perhaps using an xml document, and then simply look up the
text using the value received from Request via an XPath query usnig
selectSingleNod e.
3. Or, if you could, when you originally build the options, disconnect the
recordset from the database, use its Save method to save it as xml and
either save it to a file or to a session variable, thenwhen processing the
request, open a new recordset using the xml-persisted recordset as the
source.
Think about it and decide which route you wish to take. If you decide on the
first option and need help implementing it, you should move this
conversation to a client-side scripting group such as
microsoft.publi c.scripting.jsc ript. Otherwise, get back to us for help with
either of the other two options.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"