Anyone of these should work fine as the first if() in the function I
posted...
if(document.forms[0].selectAdmin.selectedIndex == 0) {}
if(document.forms[0].selectAdmin.options[0].selected) {}
if(document.forms[0].selectAdmin.value == 'xox') {}
They seem to all work well across the board for me.
-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 10, 2006 1:53 PM
To: CF-Talk
Subject: RE: Tricky Form validation Question (for me at least)
I've always used the options array as well but recently have been using
value with no problems or complaints.
-----Original Message-----
From: Charlie Griefer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 10, 2006 1:41 PM
To: CF-Talk
Subject: Re: Tricky Form validation Question (for me at least)
maybe i'm just old and a creature of habit, but i've always referenced
select elements via the options array. i've seen people access the
value directly (and i know it works in newer browsers)...but when i
cry a little :)
i have looked into it to see if it's "valid" (standard) or not...i've
asked people that I consider to be JS gurus...and i've never gotten
any answer other than "it works".
i know newer browsers will support it, but i still don't know if it's
"standard", so I prefer to stick to the old-fashioned way (FWIW).
On 10/10/06, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Mosh,
>
> I am pretty sure that select boxes do have a "value" attribute... Maybe
> its not standard?
>
> <form>
> <select onchange="alert( this.value );">
> <option value="A">ONE</option>
> <option value="B">TWO</option>
> <option value="C">THREE</option>
> </select>
> </form>
>
> Works fine for me.
>
> ......................
> Ben Nadel
> Certified Advanced ColdFusion Developer
> www.bennadel.com
>
>
> -----Original Message-----
> From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 10, 2006 12:42 PM
> To: CF-Talk
> Subject: RE: Tricky Form validation Question (for me at least)
>
> Ben Nadel wrote:
> > if ( document.form[ 0 ].elements[ "selectAdmin" ].value == "0" ){
>
> Select elements do not have a "value" property. Replace "value" with
> "selectedIndex" (use this capitalization) and the above code should work
> fine.
>
> --
> Mosh Teitelbaum
> evoch, LLC
> Tel: (301) 942-5378
> Fax: (301) 933-3651
> Email: [EMAIL PROTECTED]
> WWW: http://www.evoch.com/
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256154
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4