473,770 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2147
<br*******@gmai l.com> wrote in message
news:11******** *************@i 39g2000cwa.goog legroups.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.selecte dIndex].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.opti ons[document.forms[0].selHomeID.sele ctedIndex].text;

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

Mar 9 '06 #3
<br*******@gmai l.com> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.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.opti ons[document.forms[0].selHomeID.sele ctedInde
x].text;
Can you explain this a little and how I should be using it.


What error? Try this "as-is".

<html>
<head>
<title>selHomeI D.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(HomeAddre ss);
}
</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
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"
Mar 9 '06 #5
"br*******@gmai l.com" <br*******@gmai l.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">R ed</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
4565
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 any other way to drop node 3 from my setup of 5 nodes than to make a partmap file, DNODE_tmap, formatted so 1 2 4
1
5795
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 schema schema1? thanks
10
26139
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 null references another, FK_LASTLYOID bigint not null references lastly, unique (FK_OTHEROID,FK_ANOTHEROID))
8
20841
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 and I have access to .net and the like, but I would really like to keep it simple.
6
3561
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 where the user can run on firefox/mozilla, what would be a good approach. 1. Should I overwrite the javascript code drag-and-drop to make it more browser independent. If I want to go this route, can anybody provide me a
3
10598
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
4715
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 I drop onto the shell I want a file created with a specified name containing the data from the database. I've looked at the FileDrop format but it look to have only the filename and not the data. TIA
15
10830
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", which depends on it. SQLSTATE=42893 Then I tried to do
1
4823
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 because i need to do some validation checking before extracting the files from the zip archive (e.g. validate archive password). Any help or some sample codes would be very much appreciated.
5
13809
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 drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you guys can easier understand it engine. What exactly we need when trying to make a column drag &...
0
9618
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9906
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.