We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

AutoComplete Entered value must be in list

In my auto complete I want the person to only be able to enter the values in the list.

<script>
   
    var data = [{"Disabled":false,"Group":null,"Selected":false,"Text":"Worsley Wigwams","Value":"5c2c1add-c1ca-43e5-9ce9-55a63c2052be"},{"Disabled":false,"Group":null,"Selected":false,"Text":"Peters Amazing Builders","Value":"d85fda94-0301-4eac-b8bf-5e5220cf1cfe"},{"Disabled":false,"Group":null,"Selected":false,"Text":"Hancocks Hammers","Value":"893ccd71-9af9-4f5b-9977-678ccc2a97f2"},{"Disabled":false,"Group":null,"Selected":false,"Text":"PH Services","Value":"eaba37db-54ad-4cc7-8b1b-6ab3e0e84447"},{"Disabled":false,"Group":null,"Selected":false,"Text":"Walkden Construction","Value":"1ebb1508-9336-478e-baf5-c4139507be3d"},{"Disabled":false,"Group":null,"Selected":false,"Text":"Little Hultons Little Builders","Value":"c471598c-485b-4ea0-b362-f4a46af70650"}];
    $(function () {
        var value = $('#Subcontractor_Description').val();
        $('#Subcontractor_Description').ejAutocomplete({
            dataSource: data,
            fields: { key: "Text", text: "Text" },
            highlightSearch: true,
            showRoundedCorner: true,
            value: value
        });
    });

</script>

1 Reply

ES Ezhil S Syncfusion Team April 21, 2015 10:10 AM UTC

Hi Peter,

Thank you for contacting Syncfusion support.

Query: In my auto complete I want the person to only be able to enter the values in the list.
As per the query, do you want to restrict the user to type only the characters that are available in the list? That is you process each characters entered in the AutoComplete text box and compare it to the available suggestion list to restrict the next character to be typed in the input. For example with the shared code data source on typing “P” the next letter allowed to type for is either “E” or “H” and you will be disabled to enter other characters in the AutoComplete text box. If this is not your requirement on AutoComplete please describe us your query in detail so that we can provide you an appropriate solution ASAP.

Please let us know if you have any other queries.

Regards,
Ezhil S

Loader.
Live Chat Icon For mobile
Up arrow icon