[Javascript] select list option sending

Mike Dougherty mdougherty at pbp.com
Thu Oct 9 13:37:20 CDT 2003


<select id='City'>
  <option value='17'>New York</option>
  <option value='13'>Los Angeles</option>
  <option value='6'>Boston</option>
</select>
 
when the CITY gets back to the server it will have the ID value - since
this is basic HTML, there's no browser version/scripting issues either.

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of David S Levy
Sent: Thursday, October 09, 2003 1:11 PM
To: [JavaScript List]
Subject: [Javascript] select list option sending


Hey.  I'm trying to make a dropdown(select) list of locations in a form,
but instead of sending off the location name on submittal, I'd like to
send an associated location ID, since I'm working with a database.  I
was wondering if I can set up a form element with a name and without a
type on selection of a given dropdown option.  To elaborate:
 
Let's say I have a dropdown list of the following cities:
 
New York
Los Angeles
Boston
 
And each of these cities has associated with it a location ID, like:
New York - 17
Los Angeles - 13
Boston - 6
 
I'd like a way to list the cities but send the ID's.  Could I do
something within the <option> tag like onselect="this.form.city_ID=17"
for New York?  If yes, could I just do it like that or would I need to
declare the form element city_ID as a hidden variable or something along
those lines?  If not, does anyone have any ideas?  I hope my javascript
idea is understandable, I'm just turning to this language in order to
move along a project that's primarily in PHP.
 
Thanks,
 
David.
  _____  

The information contained in this communication may be confidential, is

intended only for the use of the recipient(s) named above, and may be

legally privileged.  You are hereby notified that any dissemination,

distribution or copying of this communication and any of its contents or

attachments is strictly prohibited.  If you have received this

communication in error, please notify us immediately by replying to this

message and please delete this message from all computers and servers.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20031009/dbb2b243/attachment.htm>


More information about the Javascript mailing list