You want to use something like the following
// performs type ahead functionality
function fnTypeAhead(formName, obj, fieldName, friendlyName)
{
if ( obj.value == '[type ahead]' )
return
var dropdownValue;
// create the dropdown object
var objPositionName = eval('document.' + formName + '.' +
fieldName);
// loop over the drop down
for ( var i=0; i < objPositionName.length; i++ )
{
// get substring from the dropdown value
dropdownValue =
objPositionName.options[i].text.substring(0,obj.value.length);
// check if the value of the dropdown matches our value
if ( dropdownValue.toLowerCase() == obj.value.toLowerCase()
)
{
objPositionName.options[i].selected = true;
return
} // end if
} // end loop
// alert the user about no records found
alert('No records found for "' + obj.value + '" in ' + friendlyName
+ '!');
obj.value = obj.value.substring(0,obj.value.length-1);
}
You can see it in action on:
http://development.tacofleur.com/ccdb/index.cfm?page=contactSearch&advanced=
true
Taco Fleur
Blog http://www.tacofleur.com/index/blog/
Methodology http://www.tacofleur.com/index/methodology/
0421 851 786
Tell me and I will forget
Show me and I will remember
Teach me and I will learn
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of KNOTT, Brian
> Sent: Friday, 23 January 2004 9:23 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] Select Boxes
>
>
> I want to be able to select from a select box by typing the
> first couple of character. Present the select box will only
> search on the first character.
>
> ie If I hit K it moves to the beginning on the K's. If I hit
> KN, I want it to move to the beginning of the KN's.
>
> Brian Knott
>
>
>
>
> --------------------------------------------------------------
> ---------------------
>
> The contents of this message are the views of the Author and
> do not necessarily reflect the views of SUNCORP METWAY LTD
> ABN 66 010 831 722.
>
> The content of this e-mail, including attachments is a
> confidential communication between the Suncorp Metway Group
> and the intended addressee. Any unauthorised use of the
> contents is expressly prohibited. If you have received this
> e-mail in error please contact the sender immediately and
> then delete the message and any attachment(s).
>
http://www.suncorp.com.au
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004