Shows a textbox. When the user types in the textbox a list of search results is shown. The user can choose one value from the list or continue writing. The control only accepts values from the list of search results.
The control in its initial state.
If the user clicks the search icon on an empty control, it will list all the available choices.
If the user types in the textbox, the list will be filtered accordingly.
If the user has not picked something from the list, and the control loses focus, then the item that best fits what the user has typed will be selected. If there is no match at all, then the control will be cleared.
This call is made repeatedly as the user types into the textbox, and returns a list of search results for the entered value.
Each column where the name starts with "ListColumn_" augments the value displayed in the listbox with a left aligned column of text. No headings are shown in the list.
Gets the value to show in the textbox for a given id.
This call is made first when the page is first loaded and every time the control's value is changed by a default value dependency or a JavaScript.
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.
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 autosearch works like a slimmed down version of "Textbox with popup". The popup is opened automatically as the user types. However, only an ID-value and a friendly value is supported, much like a dropdown control.
CREATE PROCEDURE Example.TextboxWithAutosearchTable_TextboxWithAutosearch
@Id varchar(max) = NULL,
@Value nvarchar(max) = NULL,
@TopN int = 7
AS
BEGIN
-- SQL Call: ID Lookup
IF @Id IS NOT NULL
BEGIN
SELECT
T.TextboxWithAutosearchTableId,
T.TextboxWithAutosearchTableName
FROM
(
VALUES
(1, 'Audi'),
(2, 'Bentley'),
(3, 'Chevrolet'),
(4, 'Volvo Cars'),
(5, 'Volvo Trucks')
) AS T (TextboxWithAutosearchTableId, TextboxWithAutosearchTableName)
WHERE
T.TextboxWithAutosearchTableId = @Id;
RETURN;
END;
-- If you need to be able to search for %, [], [^], _ - make sure you use the escape function below.
SELECT @Value = ISNULL(SoftadminUtil.String_EscapeLikeWildcards(@Value), '') + '%';
-- SQL Call: Search
SELECT TOP (@TopN)
T.TextboxWithAutosearchTableId,
T.TextboxWithAutosearchTableName
FROM
(
VALUES
(1, 'Audi'),
(2, 'Bentley'),
(3, 'Chevrolet'),
(4, 'Volvo Cars'),
(5, 'Volvo Trucks')
) AS T (TextboxWithAutosearchTableId, TextboxWithAutosearchTableName)
WHERE
T.TextboxWithAutosearchTableName LIKE @Value;
END;
Escape searched value.
SELECT @Value = SoftadminUtil.String_EscapeLikeWildcards(@Value);