This is a migrated thread and some comments may be shown as answers.

Turn off/on (stop and start) AutoComplete and Suggest after init

6 Answers 1515 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 29 Mar 2012, 01:14 AM

I would like to turn off (and back on) the auto suggest/auto complete functionality based on user selection.

Here is the scenario:

I have an address form with the fields Suburb, State, Postcode and Country (screen shot attached)

  -   When the Country (kendoDropDownList) is set to “Australia” the Suburb box suggests items based on the Australia post listings (datasource is a webservice)  and the State and Post Code fields are also disabled as they are populated by the AutoComplete data item.

  -   Now, when the user selects a country other than “Australia” I want the Suburb box to stop suggesting Australian suburbs and re-enable the State and Post Code fields.

Binding to the DropDownList’s select event is fine and re-enabling the fields works, but I can’t work out how to stop the AutoComplete box.

Any help is greatly appreciated!
Thanks

6 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 29 Mar 2012, 01:22 PM
Hello Matt,

 
Did you check the enable method of the autocomplete widget? I believe it will do the work. Let me know if I am missing something.

Kind regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Matt
Top achievements
Rank 1
answered on 30 Mar 2012, 12:46 AM
Hi Georgi,

Sorry I wasn't clear in my initial post. I would like the AutoComplete to function as a normal text box when the Country is not set to Australia. Basically, I'm after a way to turn the dropdown & suggest functionality off and then back on.

Thanks for your reply,
Matt
0
Accepted
Georgi Krustev
Telerik team
answered on 02 Apr 2012, 03:55 PM
Hi Matt,

 
One possible solution is to replace the autocomplete widget with a simple input element when needed. The other option is to stop suggestion and prevent opening of the popup. Check this jsFiddle demo.

Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Matt
Top achievements
Rank 1
answered on 02 Apr 2012, 04:05 PM
Worked like a charm, thanks!
0
Francis
Top achievements
Rank 1
answered on 14 Mar 2016, 07:00 PM
instead of the ability to turn it on and off. how can you disable it all together. I want the input to be able to give results once the user types but when I delete the text, it gives me a suggestion of all the data. I don't want that. How do I disable the suggestion all together? 
0
Georgi Krustev
Telerik team
answered on 17 Mar 2016, 11:30 AM
Hello Francis,

You can accomplish your goal preventing the filtering event: Check the last code snippet in the filtering event section.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
AutoComplete
Asked by
Matt
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Matt
Top achievements
Rank 1
Francis
Top achievements
Rank 1
Share this question
or