Hey Steve,
Is it the following that your after?
document.[form name].[field name].options[i].text
document.[form name].[field name].options[i].value
where i is the selected index i.e. document.[form name].[field
name].selectedIndex or for multiple select
for ( var i = 0; i < document.[form name].[field name].options.length;
i++ )
{
if ( document.[form name].[field name].options[i].selected )
{
document.[form name].[field name].options[i].text
document.[form name].[field name].options[i].value
}
}
Pfeewww, I hope that's it, it's early and I have not tested it.
Taco
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Onnis
Sent: Sunday, 6 July 2003 3:46 AM
To: CFAussie Mailing List
Subject: [cfaussie] Accessing both value and text from a select box
Hey hey
Can anyone suggest a nice way to be able to access both the value of a
select box option and the text of a select box option from a form
submission?
Am doing some client side manipulation of select boxes and am changing
the value of the options on the fly. Each option has a value, being the
ID from the database and the text being the text value.
I want to be able to update the value depending on its ID in the option
value.
Cant think of anything off the top of my head apart from writing more
dam javascript (which I have been doing for the last 24 hours [dam
debuging])
Regards
Steve
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
unsubscribe send a blank email to
[EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/