[Javascript] select list option sending
David S Levy
dlevy at lancer-ins.com
Thu Oct 9 13:47:28 CDT 2003
MessageI didn't know there was a value attribute to the <option> tag. Previously I'd set it up like:
<select>
<option>Option 1
<option>Option 2
<option>Option 3
</select>
In which case if I selected Option 2 the value of the variable sent would be "Option 2". So to be clear, if I use <option value="value1">hoople</option> the value setting will replace the "hoople" listed between the <option> and </option> brackets? If so, sorry for asking something so trivial.
----- Original Message -----
From: Mike Dougherty
To: '[JavaScript List]'
Sent: Thursday, October 09, 2003 2:37 PM
Subject: RE: [Javascript] select list option sending
<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.
------------------------------------------------------------------------------
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20031009/2b8f5ecb/attachment.htm>
More information about the Javascript
mailing list