Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIAutoCompleteInput

This interface monitors the input in a text field and displays an autocomplete panel at the appropriate time.
Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Method overview

ACString getSearchAt(in unsigned long index);
void onSearchBegin();
void onSearchComplete();
boolean onTextEntered();
boolean onTextReverted();
void selectTextRange(in long startIndex, in long endIndex);

Attributes

Attribute Type Description
completeDefaultIndex boolean If a search result has its defaultIndex set, this will optionally try to complete the text in the textbox to the entire text of the result at the default index as the user types. This means that auto-fill is enabled.
completeSelectedIndex boolean If true, the text in the text field will be autocompleted as the user selects from the popup list.
consumeRollupEvent boolean If true, the event that rolls up the popup should be consumed by the popup itself. If false, the rollup event will be dispatched. Read only.
controller nsIAutoCompleteController The controller. Read only.
disableAutoComplete boolean true if auto-complete is currently disabled; otherwise false.
forceComplete boolean If true, the text field automatically completes to the default result whenever the user hits the enter key or the text field loses focus.
maxRows unsigned long The maximum number of rows to display in the autocomplete suggestion popup.
minResultsForPopup unsigned long Specifies a minimum number of search results that must be available before the autocomplete popup will open.
popup nsIAutoCompletePopup The view in which results will be displayed.Read only.
popupOpen boolean Indicates whether or not the popup view is already open.
searchCount unsigned long The number of autocomplete sessions to search. Read only.
searchParam AString An additional parameter used for configuring searches.
selectionEnd long The ending index of the current selection in the text field. Read only.
selectionStart long The starting index of the current selection in the text field. Read only.
showCommentColumn boolean If true, a column is added to the popup, showing the comment for each autocomplete result.
showImageColumn boolean If true, a column is added to the popup, showing an additional image for each autocomplete result.
textValue AString The value of the text in the autocomplete text field.
timeout unsigned long The number of milliseconds after a keystroke before a search begins.

Methods

getSearchAt()

Returns the name of one of the autocomplete search session objects.

ACString getSearchAt(
  in unsigned long index
);
Parameters
index
The index number of the search session object whose name is to be returned.
Return value

The name of the specified object.

Requires Gecko 1.9 (Firefox 3)

onSearchBegin()

Called when the search starts.

void onSearchBegin();
Parameters

None.

onSearchComplete()

Called when the search ends successfully.

void onSearchComplete();
Parameters

None.

onTextEntered()

Called when the user selects and presses enter on a result item.

boolean onTextEntered();
Parameters

None.

Return value

Return true to prevent handling the selection.

onTextReverted()

Called when the user cancels the autocomplete session.

boolean onTextReverted();
Parameters

None.

Return value

Return true to prevent the reversion.

selectTextRange()

Selects a range of text in the autocomplete text field.

void selectTextRange(
  in long startIndex,
  in long endIndex
);
Parameters
startIndex
The index to the first character in the text field to select.
endIndex
The index to the last character in the text field to select.

Document Tags and Contributors

 Contributors to this page: Sheppy, sachin.hosmani, trevorh, Zhouweikuan
 Last updated by: Sheppy,