Yup figured it out. Thanks.
var DD = document.getElementById("ItemNameA");
var DDSelIndex = DD.selectedIndex;
var DDValue = DD.options[DDSelIndex].value;
-----Original Message-----
From: Russ Michaels [mailto:[email protected]]
Sent: Wednesday, January 04, 2012 5:03 PM
To: cf-talk
Subject: Re: Need selectedIndex of cfselect after bind
to get the value use
dd.value
to get the text of the selectIndex use
DD.options[DD.selectedIndex].text
On Wed, Jan 4, 2012 at 9:03 PM, <[email protected]> wrote:
>
> Ok I have some code that allows a user to type a word in a cfinput and
> then it suggests records from the database in a cfselect that is bound
> to that cfinput. Then I need to be able to submit that record using
> ajax to insert some data into a database.
>
>
>
> The problem comes in when I try to reference the items in the cfselect
> drop down by using the JavaScript for getting the value of the
> selected record like so
>
>
>
> var DD = document.getElementById("ItemNameB");
>
> DD.options[DD.selectedIndex].value
>
>
>
> When I try this and submit it I get the error
>
>
>
> "Index or size is negative or greater than the allowed amount"
>
>
>
> It seems as if the JavaScript cannot access the records brought in
> from the database after the bind. Can anybody confirm this? Have a
> suggestion for a different way to get that value?
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349316
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm