Shows a textbox. When the user types in the textbox a list of suggestions is shown. The user can choose one suggestion from the list or continue writing. The control accepts values not in the list of suggestions.
The control in its initial state.
When the user starts typing, the matching alternatives are listed, and the first match is inserted as auto-complete.
The list and auto-suggest is only just that, a suggestion. The user can still type something else.
When the control loses focus, the text entered will remain unchanged.
This call is made repeatedly as the user types into the textbox, and returns a list of suggestions that can autocomplete to the typed value.
To make the control have the proper responsiveness it is imperative that the procedure returns quickly, preferably in less than 100 ms.
Retrieves the default value for the control.
This call is only made if there is a field validation set for the field info and the field has any content. Fields used in an editable grid do not use this call.
Performs field validation when the user leaves the field or one of its dependencies is changed, initial values set by default value and initial values in edit-mode are not validated.
When saving the validation runs server side if the field value has changed. A field value is considered changed if in new mode the value is anything other than NULL
. In edit mode it is considered changed if it has a value that was not returned by the GetEditFields procedure.
"Textbox with autosuggest" works like a "Textbox with dropdown" because it allows any text to be entered, even if it's not included in the list. But it also works like a "textbox with popup" as it continously searches a stored procedure for suggestions. The ”Auto” part is that the popup is opened automatically as you type and not on "tab".
The control is best suited to autocompletion of names and search words. If you want to replace a "Textbox with popup", then you should use "Textbox with autosearch" instead.
CREATE PROCEDURE Example.TextboxWithAutosuggestTable_TextboxWithAutosuggest
@TopN int = 7,
@Value nvarchar(max)
AS
BEGIN
-- You have to use the escape function below, or else the control will crash if you search for %, [], [^] and _
SELECT @Value = ISNULL(SoftadminUtil.String_EscapeLikeWildcards(@Value), '') + '%';
SELECT DISTINCT TOP (@TopN)
T.TextboxWithAutosuggestTableName
FROM
(
VALUES
(1, 'alpha'),
(2, 'beta'),
(3, 'gamma'),
(4, 'delta')
) AS T (TextboxWithAutosuggestTableId, TextboxWithAutosuggestTableName)
WHERE
T.TextboxWithAutosuggestTableName LIKE @Value
ORDER BY
T.TextboxWithAutosuggestTableName;
END;
Escape searched value.
SELECT @Value = SoftadminUtil.String_EscapeLikeWildcards(@Value);