API: autocomplete YAHOO.widget.AutoComplete (YUI Library)

# Yahoo! UI Library

### AutoComplete Widget 2.9.0

Yahoo! UI Library > autocomplete > YAHOO.widget.AutoComplete
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.widget.AutoComplete

The AutoComplete class provides the customizable functionality of a plug-and-play DHTML auto completion widget. Some key features:

- Navigate with up/down arrow keys and/or mouse to pick a selection
- The drop down container can "roll down" or "fly out" via configurable animation
- UI look-and-feel customizable through CSS, including container attributes, borders, position, fonts, etc

### Constructor

YAHOO.widget.AutoComplete `( elInput , elContainer , oDataSource , oConfigs )`

Parameters:
  `elInput <HTMLElement>` DOM element reference of an input field.
  `elInput <String>` String ID of an input field.
  `elContainer <HTMLElement>` DOM element reference of an existing DIV.
  `elContainer <String>` String ID of an existing DIV.
  `oDataSource <YAHOO.widget.DataSource>` DataSource instance.
  `oConfigs <Object>` (optional) Object literal of configuration params.

### Properties

#### _bContainerOpen - `private Boolean`

Whether or not the results container is currently open.

#### _bFocused - `private Boolean`

Whether or not the widget instance is currently active. If query results come back but the user has already moved on, do not proceed with auto complete behavior.

#### _bItemSelected - `private Boolean`

Whether or not an item has been selected since the container was populated with results. Reset to false by _populateList, and set to true when item is selected.

#### _bOverContainer - `private Boolean`

Whether or not the mouse is currently over the results container. This is necessary in order to prevent clicks on container items from being text input field blur events.

#### _elBody - `private HTMLElement`

Reference to body element within content element.

#### _elContainer - `private HTMLElement`

Container DOM element.

#### _elContent - `private HTMLElement`

Reference to content element within container element.

#### _elCurListItem - `private HTMLElement`

Pointer to the currently highlighted <li> element in the container.

#### _elCurPrehighlightItem - `private HTMLElement`

Pointer to the currently pre-highlighted <li> element in the container.

#### _elFooter - `private HTMLElement`

Reference to footer element within content element.

#### _elHeader - `private HTMLElement`

Reference to header element within content element.

#### _elIFrame - `private HTMLElement`

Reference to iframe element within container element.

#### _elList - `private HTMLElement`

Internal reference to <ul> elements that contains query results within the results container.

#### _elShadow - `private HTMLElement`

Reference to shadow element within container element.

#### _elTextbox - `private HTMLElement`

Text input field DOM element.

#### _iFrameSrc - `private String`

Src to iFrame used when useIFrame = true. Supports implementations over SSL as well.

#### _nDelayID - `private Number`

Delay timeout ID.

#### _nDisplayedItems - `private Number`

Number of <li> elements currently displayed in results container.

#### _nIndex - `private Number`

Internal class variable to index multiple AutoComplete instances.
Default Value: 0

#### _nKeyCode - `private Number`

Key code of the last key pressed in textbox.

#### _nTypeAheadDelayID - `private Number`

TypeAhead delay timeout ID.

#### _oAnim - `private Boolean`

Animation instance for container expand/collapse.

#### _queryInterval - `private Object`

For users typing via certain IMEs, queries must be triggered by intervals, since key events yet supported across all browsers for all IMEs.

#### _sCurQuery - `private String`

Current query string

#### _sInitInputValue - `private String`

Stores initial input value used to determine if textboxChangeEvent should be fired.

#### _sName - `private String`

Name of AutoComplete instance.

#### _sPastSelections - `private String`

Selections from previous queries (for saving delimited queries).
Default Value: ""

#### allowBrowserAutocomplete - `Boolean`

Whether or not to allow browsers to cache user-typed input in the input field. Disabling this feature will prevent the widget from setting the autocomplete="off" on the input field. When autocomplete="off" and users click the back button after form submission, user-typed input can be prefilled by the browser from its cache. This caching of user input may not be desired for sensitive data, such as credit card numbers, in which case, implementers should consider setting allowBrowserAutocomplete to false.
Default Value: true

#### alwaysShowContainer - `Boolean`

Enabling this feature prevents the toggling of the container to a collapsed state. Setting to true does not automatically trigger the opening of the container. Implementers are advised to pre-load the container with an explicit "sendQuery()" call.
Default Value: false

#### animHoriz - `Boolean`

Whether or not to animate the expansion/collapse of the results container in the horizontal direction.
Default Value: false

#### animSpeed - `Number`

Speed of container expand/collapse animation, in seconds..
Default Value: 0.3

#### animVert - `Boolean`

Whether or not to animate the expansion/collapse of the results container in the vertical direction.
Default Value: true

#### applyLocalFilter - `Boolean`

By default, results from local DataSources will pass through the filterResults method to apply a client-side matching algorithm.
Default Value: true for local arrays and json, otherwise false

#### autoHighlight - `Boolean`

Whether or not the first item in results container should be automatically highlighted on expand.
Default Value: true

#### autoSnapContainer - `Boolean`

If true, before each time the container expands, the container element will be positioned to snap to the bottom-left corner of the input element. If autoSnapContainer is set to false, this positioning will not be done.
Default Value: true

#### dataSource - `YAHOO.widget.DataSource`

The DataSource object that encapsulates the data used for auto completion. This object should be an inherited object from YAHOO.widget.DataSource.

#### delimChar - `String | String[]`

Query delimiter. A single character separator for multiple delimited selections. Multiple delimiter characteres may be defined as an array of strings. A null value or empty string indicates that query results cannot be delimited. This feature is not recommended if you need forceSelection to be true.

#### forceSelection - `Boolean`

Whether or not to force the user's selection to match one of the query results. Enabling this feature essentially transforms the input field into a <select> field. This feature is not recommended with delimiter character(s) defined.
Default Value: false

#### highlightClassName - `String`

Class name of a highlighted item within results container.
Default Value: "yui-ac-highlight"

#### maxResultsDisplayed - `Number`

Maximum number of results to display in results container.
Default Value: 10

#### minQueryLength - `Number`

Number of characters that must be entered before querying for results. A negative value effectively turns off the widget. A value of 0 allows queries of null or empty string values.
Default Value: 1

#### prehighlightClassName - `String`

Class name of a pre-highlighted item within results container.

#### queryDelay - `Number`

Number of seconds to delay before submitting a query request. If a query request is received before a previous one has completed its delay, the previous request is cancelled and the new request is set to the delay. If typeAhead is also enabled, this value must always be less than the typeAheadDelay in order to avoid certain race conditions.
Default Value: 0.2

#### queryInterval - `Number`

When IME usage is detected or interval detection is explicitly enabled, AutoComplete will detect the input value at the given interval and send a query if the value has changed.
Default Value: 500

#### queryMatchCase - `Boolean`

When applyLocalFilter is true, the local filtering algorthim can have case sensitivity enabled.
Default Value: false

#### queryMatchContains - `Boolean`

When applyLocalFilter is true, results can be locally filtered to return matching strings that "contain" the query string rather than simply "start with" the query string.
Default Value: false

#### queryMatchSubset - `Boolean`

Enables query subset matching. When the DataSource's cache is enabled and queryMatchSubset is true, substrings of queries will return matching cached results. For instance, if the first query is for "abc" susequent queries that start with "abc", like "abcd", will be queried against the cache, and not the live data source. Recommended only for DataSources that return comprehensive results for queries with very few characters.
Default Value: false

#### queryQuestionMark - `Boolean`

For XHR DataSources, AutoComplete will automatically insert a "?" between the server URI and the "query" param/value pair. To prevent this behavior, implementers should set this value to false. To more fully customize the query syntax, implementers should override the generateRequest() method.
Default Value: true

#### resultTypeList - `Boolean`

For backward compatibility to pre-2.6.0 formatResults() signatures, setting resultsTypeList to true will take each object literal result returned by DataSource and flatten into an array.
Default Value: true

#### suppressInputUpdate - `Boolean`

Whether or not the input field should be updated with selections.
Default Value: false

#### typeAhead - `Boolean`

If autohighlight is enabled, whether or not the input field should be automatically updated with the first query result as the user types, auto-selecting the substring portion of the first result that the user has not yet typed.
Default Value: false

#### typeAheadDelay - `Number`

If typeAhead is true, number of seconds to delay before updating input with typeAhead value. In order to prevent certain race conditions, this value must always be greater than the queryDelay.
Default Value: 0.5

#### useIFrame - `Boolean`

Whether or not to use an iFrame to layer over Windows form elements in IE. Set to true only when the results container will be on top of a <select> field in IE and thus exposed to the IE z-index bug (i.e., 5.5 < IE < 7).
Default Value: false

#### useShadow - `Boolean`

Whether or not the results container should have a shadow.
Default Value: false

### Methods

#### __initProps

`private void __initProps ( )`
Updates and validates latest public config properties.

#### _clearInterval

`private void _clearInterval ( oSelf )`
Cancels text input detection by intervals.

Parameters:
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _clearSelection

`private void _clearSelection ( )`
When forceSelection is true and the user attempts leave the text input box without selecting an item from the query results, the user selection is cleared.

#### _doBeforeExpandContainer

`private Boolean _doBeforeExpandContainer ( elTextbox , elContainer , sQuery , aResults )`
Called before container expands, by default snaps container to the bottom-left corner of the input element, then calls public overrideable method.

Parameters:
  `elTextbox <HTMLElement>` The text input box.
  `elContainer <HTMLElement>` The container element.
  `sQuery <String>` The query string.
  `aResults <Object[]>` An array of query results.

Returns: `Boolean`
  Return true to continue expanding container, false to cancel the expand.

#### _enableIntervalDetection

`private void _enableIntervalDetection ( )`
Enables interval detection for IME support.

#### _extractQuery

`private Object _extractQuery ( sQuery )`
Extracts rightmost query from delimited string.

Parameters:
  `sQuery <String>` String to parse

Returns: `Object`
  Object literal containing properties "query" and "previous".

#### _focus

`private void _focus ( )`
Focuses input field.

#### _initContainerEl

`private void _initContainerEl ( )`
Initializes the results container once at object creation

#### _initContainerHelperEls

`private void _initContainerHelperEls ( )`
Initializes the results container helpers if they are enabled and do not exist

#### _initListEl

`private void _initListEl ( )`
Clears out contents of container body and creates up to YAHOO.widget.AutoComplete#maxResultsDisplayed <li> elements in an <ul> element.

#### _isIgnoreKey

`private Boolean _isIgnoreKey ( nKeycode )`
Whether or not key is functional or should be ignored. Note that the right arrow key is NOT an ignored key since it triggers queries for certain intl charsets.

Parameters:
  `nKeycode <Number>` Code of key pressed.

Returns: `Boolean`
  True if key should be ignored, false otherwise.

#### _jumpSelection

`private void _jumpSelection ( )`
If an item is highlighted in the container, the right arrow key jumps to the end of the textbox and selects the highlighted item, otherwise the container is closed.

#### _moveSelection

`private void _moveSelection ( nKeyCode )`
Triggered by up and down arrow keys, changes the current highlighted <li> element item. Scrolls container if necessary.

Parameters:
  `nKeyCode <Number>` Code of key pressed.

#### _onContainerClick

`private void _onContainerClick ( v , oSelf )`
Handles container click events.

Parameters:
  `v <HTMLEvent>` The click event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onContainerMouseout

`private void _onContainerMouseout ( v , oSelf )`
Handles container mouseout events.

Parameters:
  `v <HTMLEvent>` The mouseout event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onContainerMouseover

`private void _onContainerMouseover ( v , oSelf )`
Handles container mouseover events.

Parameters:
  `v <HTMLEvent>` The mouseover event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onContainerResize

`private void _onContainerResize ( v , oSelf )`
Handles container resize events.

Parameters:
  `v <HTMLEvent>` The resize event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onContainerScroll

`private void _onContainerScroll ( v , oSelf )`
Handles container scroll events.

Parameters:
  `v <HTMLEvent>` The scroll event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onInterval

`private void _onInterval ( )`
Enables query triggers based on text input detection by intervals (rather than by key events).

#### _onTextboxBlur

`private void _onTextboxBlur ( v , oSelf )`
Handles text input box losing focus.

Parameters:
  `v <HTMLEvent>` The focus event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onTextboxFocus

`private void _onTextboxFocus ( v , oSelf )`
Handles text input box receiving focus.

Parameters:
  `v <HTMLEvent>` The focus event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onTextboxKeyDown

`private void _onTextboxKeyDown ( v , oSelf )`
Handles textbox keydown events of functional keys, mainly for UI behavior.

Parameters:
  `v <HTMLEvent>` The keydown event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onTextboxKeyPress

`private void _onTextboxKeyPress ( v , oSelf )`
Handles textbox keypress events.

Parameters:
  `v <HTMLEvent>` The keypress event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onTextboxKeyUp

`private void _onTextboxKeyUp ( v , oSelf )`
Handles textbox keyup events to trigger queries.

Parameters:
  `v <HTMLEvent>` The keyup event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _onWindowUnload

`private void _onWindowUnload ( v , oSelf )`
Handles window unload event.

Parameters:
  `v <HTMLEvent>` The unload event.
  `oSelf <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### _populateList

`private void _populateList ( sQuery , oResponse , oPayload )`
Populates the array of <li> elements in the container with query results.

Parameters:
  `sQuery <String>` Original request.
  `oResponse <Object>` Response object.
  `oPayload <MIXED>` (optional) Additional argument(s)

#### _populateListItem

`private void _populateListItem ( elListItem , oResult , sCurQuery )`
Populates the given <li> element with return value from formatResult().

Parameters:
  `elListItem <HTMLElement>` The LI element.
  `oResult <Object>` The result object.
  `sCurQuery <String>` The query string.

#### _selectItem

`private void _selectItem ( elListItem )`
Selects a result item from the container

Parameters:
  `elListItem <HTMLElement>` The selected <li> element item.

#### _selectText

`private void _selectText ( elTextbox , nStart , nEnd )`
Selects text in the input field.

Parameters:
  `elTextbox <HTMLElement>` Text input box element in which to select text.
  `nStart <Number>` Starting index of text string to select.
  `nEnd <Number>` Ending index of text selection.

#### _sendQuery

`private void _sendQuery ( sQuery )`
Makes query request to the DataSource.

Parameters:
  `sQuery <String>` Query string.

#### _textMatchesOption

`private HTMLElement _textMatchesOption ( )`
Whether or not user-typed value in the text input box matches any of the query results.

Returns: `HTMLElement`
  Matching list item element if user-input text matches a result, null otherwise.

#### _toggleContainer

`private void _toggleContainer ( bShow )`
Animates expansion or collapse of the container.

Parameters:
  `bShow <Boolean>` True if container should be expanded, false if container should be collapsed

#### _toggleContainerHelpers

`private void _toggleContainerHelpers ( bShow )`
Syncs results container with its helpers.

Parameters:
  `bShow <Boolean>` True if container is expanded, false if collapsed

#### _toggleHighlight

`private void _toggleHighlight ( elNewListItem , sType )`
Toggles the highlight on or off for an item in the container, and also cleans up highlighting of any previous item.

Parameters:
  `elNewListItem <HTMLElement>` The <li> element item to receive highlight behavior.
  `sType <String>` Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off.

#### _togglePrehighlight

`private void _togglePrehighlight ( elNewListItem , sType )`
Toggles the pre-highlight on or off for an item in the container, and also cleans up pre-highlighting of any previous item.

Parameters:
  `elNewListItem <HTMLElement>` The <li> element item to receive highlight behavior.
  `sType <String>` Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off.

#### _typeAhead

`private void _typeAhead ( elListItem , sQuery )`
Updates in the text input box with the first query result as the user types, selecting the substring that the user has not typed.

Parameters:
  `elListItem <HTMLElement>` The <li> element item whose data populates the input field.
  `sQuery <String>` Query string.

#### _updateValue

`private void _updateValue ( elListItem )`
Updates the text input box value with selected query result. If a delimiter has been defined, then the value gets appended with the delimiter.

Parameters:
  `elListItem <HTMLElement>` The <li> element item with which to update the value.

#### AutoComplete._cloneObject

`private static void AutoComplete._cloneObject ( o )`
Clones object literal or array of object literals.

Parameters:
  `o <Object>` Object.

#### clearList

`void clearList ( )`
Clears entire list of suggestions.

#### collapseContainer

`void collapseContainer ( )`
Collapses container.

#### destroy

`void destroy ( )`
Nulls out the entire AutoComplete instance and related objects, removes attached event listeners, and clears out DOM elements inside the container. After calling this method, the instance reference should be expliclitly nulled by implementer, as in myAutoComplete = null. Use with caution!

#### doBeforeExpandContainer

`Boolean doBeforeExpandContainer ( elTextbox , elContainer , sQuery , aResults )`
Overridable method called before container expands allows implementers to access data and DOM elements.

Parameters:
  `elTextbox <HTMLElement>` The text input box.
  `elContainer <HTMLElement>` The container element.
  `sQuery <String>` The query string.
  `aResults <Object[]>` An array of query results.

Returns: `Boolean`
  Return true to continue expanding container, false to cancel the expand.

#### doBeforeLoadData

`Boolean doBeforeLoadData ( sQuery , oResponse , oPayload )`
Overridable method called before container is loaded with result data.

Parameters:
  `sQuery <String>` Original request.
  `oResponse <Object>` Response object.
  `oPayload <MIXED>` (optional) Additional argument(s)

Returns: `Boolean`
  Return true to continue loading data, false to cancel.

#### doBeforeSendQuery

`void doBeforeSendQuery ( )`
Deprecated Use generateRequest.

#### enableIntervalDetection

`void enableIntervalDetection ( )`
Enables interval detection for a less performant but brute force mechanism to detect input values at an interval set by queryInterval and send queries if input value has changed. Needed to support right-click+paste or shift+insert edge cases. Please note that intervals are cleared at the end of each interaction, so enableIntervalDetection must be called for each new interaction. The recommended approach is to call it in response to textboxFocusEvent.

#### expandContainer

`void expandContainer ( )`
Expands container.

#### filterResults

`Object filterResults ( sQuery , oFullResponse , oParsedResponse , oCallback )`
Executed by DataSource (within DataSource scope via doBeforeCallback()) to filter results through a simple client-side matching algorithm.

Parameters:
  `sQuery <String>` Original request.
  `oFullResponse <Object>` Full response object.
  `oParsedResponse <Object>` Parsed response object.
  `oCallback <Object>` Callback object.

Returns: `Object`
  Filtered response object.

#### formatEscapedResult

`String formatEscapedResult ( oResultData , sQuery , sResultMatch )`
An alternative to the formatResult() method, escapes the result data before inserting into DOM. Implementers should point to this method when accessing data from third-party sources, from user input, or from otherwise untrustworthy sources: myAutoComplete.formatResult = myAutoComplete.formatEscapedResult;

Parameters:
  `oResultData <Object>` Result data object.
  `sQuery <String>` The corresponding query string.
  `sResultMatch <HTMLElement>` The current query string.

Returns: `String`
  Formatted result data.

#### formatResult

`HTML formatResult ( oResultData , sQuery , sResultMatch )`
Overridable method that returns HTML markup for one result to be populated as innerHTML of an <LI> element.

Parameters:
  `oResultData <Object>` Result data object.
  `sQuery <String>` The corresponding query string.
  `sResultMatch <HTMLElement>` The current query string.

Returns: `HTML`
  HTML markup of formatted result data.

#### generateRequest

`MIXED generateRequest ( sQuery )`
A function that converts an AutoComplete query into a request value which is then passed to the DataSource's sendRequest method in order to retrieve data for the query. By default, returns a String with the syntax: "query={query}" Implementers can customize this method for custom request syntaxes.

Parameters:
  `sQuery <String>` Query string

Returns: `MIXED`
  Request

#### getContainerEl

`HTMLELement getContainerEl ( )`
Returns DOM reference to container element.

Returns: `HTMLELement`
  DOM reference to container element.

#### getInputEl

`HTMLELement getInputEl ( )`
Returns DOM reference to input element.

Returns: `HTMLELement`
  DOM reference to input element.

#### getListEl

`HTMLElement[] getListEl ( )`
Public accessor to the <ul> element that displays query results within the results container.

Returns: `HTMLElement[]`
  Reference to <ul> element within the results container.

#### getListItemData

`Object getListItemData ( elListItem )`
Public accessor to the result data associated with a given <li> result.

Parameters:
  `elListItem <HTMLElement>` Reference to <LI> element.

Returns: `Object`
  Result data.

#### getListItemIndex

`Number getListItemIndex ( elListItem )`
Public accessor to the index of the associated with a given <li> result.

Parameters:
  `elListItem <HTMLElement>` Reference to <LI> element.

Returns: `Number`
  Index.

#### getListItemMatch

`String getListItemMatch ( elListItem )`
Public accessor to the matching string associated with a given <li> result.

Parameters:
  `elListItem <HTMLElement>` Reference to <LI> element.

Returns: `String`
  Matching string.

#### getListItems

`void getListItems ( )`
Deprecated Use getListEl().childNodes.

#### getSubsetMatches

`Object getSubsetMatches ( sQuery )`
Handles subset matching for when queryMatchSubset is enabled.

Parameters:
  `sQuery <String>` Query string.

Returns: `Object`
  oParsedResponse or null.

#### handleResponse

`void handleResponse ( sQuery , oResponse , oPayload )`
Handles response for display. This is the callback function method passed to YAHOO.util.DataSourceBase#sendRequest so results from the DataSource are returned to the AutoComplete instance.

Parameters:
  `sQuery <String>` Original request.
  `oResponse <Object>` Response object.
  `oPayload <MIXED>` (optional) Additional argument(s)

#### isContainerOpen

`Boolean isContainerOpen ( )`
Returns true if container is in an expanded state, false otherwise.

Returns: `Boolean`
  Returns true if container is in an expanded state, false otherwise.

#### isFocused

`Boolean isFocused ( )`
Returns true if widget instance is currently active.

Returns: `Boolean`
  Returns true if widget instance is currently active.

#### preparseRawResponse

`Object preparseRawResponse ( sQuery )`
Executed by DataSource (within DataSource scope via doBeforeParseData()) to handle responseStripAfter cleanup.

Parameters:
  `sQuery <String>` Query string.

Returns: `Object`
  oParsedResponse or null.

#### sendQuery

`void sendQuery ( sQuery )`
Makes query request to the DataSource.

Parameters:
  `sQuery <String>` Query string.

#### setBody

`void setBody ( sBody )`
Sets HTML markup for the results container body. This markup will be inserted within a <div> tag with a class of "yui-ac-bd".

Parameters:
  `sBody <HTML>` HTML markup for results container body.

#### setFooter

`void setFooter ( sFooter )`
Sets HTML markup for the results container footer. This markup will be inserted within a <div> tag with a class of "yui-ac-ft".

Parameters:
  `sFooter <HTML>` HTML markup for results container footer.

#### setHeader

`void setHeader ( sHeader )`
Sets HTML markup for the results container header. This markup will be inserted within a <div> tag with a class of "yui-ac-hd".

Parameters:
  `sHeader <HTML>` HTML markup for results container header.

#### snapContainer

`void snapContainer ( )`
Snaps container to bottom-left corner of input element

#### toString

`String toString ( )`
Public accessor to the unique name of the AutoComplete instance.

Returns: `String`
  Unique name of the AutoComplete instance.

### Events

#### _sLastTextboxValue

`private _sLastTextboxValue ( )`
Internal tracker to last known textbox value, used to determine whether or not to trigger a query via interval for certain IME users.

#### containerCollapseEvent

`containerCollapseEvent ( type , args[0] )`
Fired when the results container is collapsed.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### containerExpandEvent

`containerExpandEvent ( type , args[0] )`
Fired when the results container is expanded.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### containerPopulateEvent

`containerPopulateEvent ( type , args[0] )`
Fired when the results container is populated.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### dataErrorEvent

`dataErrorEvent ( type , args[0] , args[1] , args[2] )`
Fired when the AutoComplete instance does not receive query results from the DataSource due to an error.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <String>` The query string.
  `args[2] <Object>` The response object, if available.

#### dataRequestCancelEvent

`dataRequestCancelEvent ( type , args[0] , args[1] )`
Fired when the AutoComplete request to the DataSource is canceled.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <String>` The query string.

#### dataRequestEvent

`dataRequestEvent ( type , args[0] , args[1] , args[2] )`
Fired when the AutoComplete instance makes a request to the DataSource.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <String>` The query string.
  `args[2] <Object>` The request.

#### dataReturnEvent

`dataReturnEvent ( type , args[0] , args[1] , args[2] )`
Fired when the AutoComplete instance receives query results from the data source.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <String>` The query string.
  `args[2] <Object[]>` Results array.

#### itemArrowFromEvent

`itemArrowFromEvent ( type , args[0[ , args[1] )`
Fired when result item has been arrowed away from.

Parameters:
  `type <String>` Name of the event.
  `args[0[ <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <HTMLElement>` The <li> element item arrowed from.

#### itemArrowToEvent

`itemArrowToEvent ( type , args[0] , args[1] )`
Fired when result item has been arrowed to.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <HTMLElement>` The <li> element item arrowed to.

#### itemMouseOutEvent

`itemMouseOutEvent ( type , args[0] , args[1] )`
Fired when result item has been moused out.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <HTMLElement>` The <li> element item moused from.

#### itemMouseOverEvent

`itemMouseOverEvent ( type , args[0] , args[1] )`
Fired when result item has been moused over.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <HTMLElement>` The <li> element item moused to.

#### itemSelectEvent

`itemSelectEvent ( type , args[0] , args[1] , args[2] )`
Fired when an item is selected via mouse click, ENTER key, or TAB key.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <HTMLElement>` The selected <li> element item.
  `args[2] <Object>` The data returned for the item, either as an object, or mapped from the schema into an array.

#### selectionEnforceEvent

`selectionEnforceEvent ( type , args[0] , args[1] )`
Fired if forceSelection is enabled and the user's input has been cleared because it did not match one of the returned query results.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <String>` The cleared value (including delimiters if applicable).

#### textboxBlurEvent

`textboxBlurEvent ( type , args[0] )`
Fired when the input field loses focus.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### textboxChangeEvent

`textboxChangeEvent ( type , args[0] )`
Fired when the input field value has changed when it loses focus.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### textboxFocusEvent

`textboxFocusEvent ( type , args[0] )`
Fired when the input field receives focus.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.

#### textboxKeyEvent

`textboxKeyEvent ( type , args[0] , args[1] )`
Fired when the input field receives key input.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <Number>` The keycode number.

#### typeAheadEvent

`typeAheadEvent ( type , args[0] , args[1] , args[2] )`
Fired when the input field has been prefilled by the type-ahead feature.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <String>` The query string.
  `args[2] <String>` The prefill string.

#### unmatchedItemSelectEvent

`unmatchedItemSelectEvent ( type , args[0] , args[1] )`
Fired when a user selection does not match any of the displayed result items.

Parameters:
  `type <String>` Name of the event.
  `args[0] <YAHOO.widget.AutoComplete>` The AutoComplete instance.
  `args[1] <String>` The selected string.

Copyright © 2011 Yahoo! Inc. All rights reserved.