AJAX Click and Script Functions > Alphabetical List of Functions > ajax_autocomplete

Support for the Click & Script protocols will be discontinued in an upcoming version.


Selects an item from a list based on text entered in a field.

Example: ajax_autocomplete Alphabetical Listing
int ajax_autocomplete( "stepname", DESCRIPTION, "Framework=framework name", "ID=control_id", ACTION, "UserAction=Set|Select", "Value = value", ["SelectByText"|"SelectByOrdinal=n",] LAST );

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure. Note that LR_PASS and LR_FAIL generally indicate whether the function call completed without an exception, and not that the test step succeeded.

All input string arguments (char type) except the step name can be parameterized using standard parameterization.

General Information

The ajax_autocomplete function emulates a user setting the value of an autocomplete-enabled edit field, called an autocomplete control.

If the "Set" action is used, the value of the control is set to the literal string passed in the Value argument.

If the "Select" action is used, the step waits for the autocomplete list to be displayed, then sets the control's value to the literal SelectByText value or to the value of the matching item at the position specified by SelectByOrdinal.

If SelectByText is used and the specified text does not appear in the list, the function fails.

If SelectByOrdinal=n is used and the number of list items that match the Value is less than n, the step fails. SelectByOrdinal is never recorded. It can be entered manually.

A random item can be selected by specifying "SelectByOrdinal=random".

The function pauses randomly to simulate a user typing. This allows requests to be sent to the server.

Note: The select operation fails with script.aculo.us versions prior to 1.8.