[Javascript] select list option sending

David S Levy dlevy at lancer-ins.com
Thu Oct 9 13:11:20 CDT 2003


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/a45a7b9b/attachment.htm>


More information about the Javascript mailing list