473,396 Members | 2,033 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 Display vs. Value

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?

Mar 9 '06 #1
5 2125
<br*******@gmail.com> wrote in message
news:11*********************@i39g2000cwa.googlegro ups.com...
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?

document.forms[0].select.options[document.forms[0].select.selectedIndex].tex
t;
Mar 9 '06 #2
I appreciate the reply but I just get an error. The DD list I'm using
is called selHomeID.
var HomeAddress =
document.forms[0].selHomeID.options[document.forms[0].selHomeID.selectedIndex].text;

Can you explain this a little and how I should be using it.

Mar 9 '06 #3
<br*******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
I appreciate the reply but I just get an error. The DD list I'm using
is called selHomeID.
var HomeAddress =
document.forms[0].selHomeID.options[document.forms[0].selHomeID.selectedInde
x].text;
Can you explain this a little and how I should be using it.


What error? Try this "as-is".

<html>
<head>
<title>selHomeID.htm</title>
<script type="text/javascript">
function HomeID() {
var form = document.form1;
var pick = form.selHomeID.selectedIndex;
var HomeAddress = form.selHomeID.options[pick].text;
alert(HomeAddress);
}
</script>
</head>
<body>
<form name="form1">
<select name="selHomeID">
<option value="1">Blue</option>
<option value="2">Red</option>
<option value="3">Green</option>
</select>
<input type="button" value="HomeID" onclick="HomeID()">
</form>
</body>
</html>
Mar 9 '06 #4
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
selectSingleNode.
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.public.scripting.jscript. 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"
Mar 9 '06 #5
"br*******@gmail.com" <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?


You could make the "values" compound, something like this:

<option value="1;blue">Blue</option>
<option value="2;red">Red</option>
<option value="3;green">Green</option>

Then use the "split" function to break the returned value into its
component parts. Now you have both the number and the string.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
Mar 9 '06 #6

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

Similar topics

1
by: riehe | last post by:
Dear all I want to drop a node from a nodegroup. Can someone confirm if its enough to redistribute a node group with a partition map which doesn't include the node to be dropped? I can't see...
1
by: Ian Dobson | last post by:
Hi, I need to drop a schema from a database but it has 400 tables in it. Is there an easy way to do it other than drop table schema1.table1 drop table schema1.table2 etc.. to 400 and then drop...
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
8
by: WindAndWaves | last post by:
Hi everyone, Has anyone got any experience with drop and drag in Access? I would like to make a calendar style form where my users can drop and drag appointments.... I am using Access 2003...
6
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When...
15
by: uwcssa | last post by:
I try to drop a table as: I got: During SQL processing it returned: SQL0478N The object type "TABLE" cannot be dropped because there is an object "sch.SQL070515104729271", of type "FUNCTION",...
1
by: Thi | last post by:
Hi, I am trying to develop an application that allows the users to drag a few file(s) from a zip archive to a destination. My question is, how do i determine where the drop destination is...
5
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.