Allow only valid selection in autocomplete

Hello, is there a way to allow only a valid option to be stored in the autocomplete value? My scenarios is to have the following DataSource `['hello']` and if the user types `h` and doesn't click the 'hello' option to not trigger a value change event.


3 Replies 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team February 16, 2022 05:44 AM UTC

 Hi Stefanos, 

We suggest you to disable the allowCustom property to allow only the items present in the datasource as per your requirement. 


<ejs-autocomplete 
        id="games" 
        #sample 
        [dataSource]="sportsData" 
        [(value)]="value" 
        [placeholder]="waterMark" 
        [fields]="fields" 
        (change)="onChange($event)" 
        [allowCustom]="false" 
      ></ejs-autocomplete> 

Regards, 
Ponmani M 


Marked as answer

SC Stefanos Chrs replied to Ponmani Murugaiyan February 16, 2022 12:25 PM UTC

Exactly what I wanted, thanks!



PM Ponmani Murugaiyan Syncfusion Team February 17, 2022 04:49 AM UTC

Hi Stefanos, 

Welcome, we are glad to hear that the issue has been resolved.  

Regards, 
Ponmani M 


Loader.
Up arrow icon