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

7 posts, 1 answers
  1. Matt
    Matt avatar
    8 posts
    Member since:
    Jun 2010

    Posted 28 Mar 2012 Link to this post

    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

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 29 Mar 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Matt
    Matt avatar
    8 posts
    Member since:
    Jun 2010

    Posted 29 Mar 2012 Link to this post

    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
  5. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 02 Apr 2012 Link to this post

    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!
  6. Matt
    Matt avatar
    8 posts
    Member since:
    Jun 2010

    Posted 02 Apr 2012 Link to this post

    Worked like a charm, thanks!
  7. Francis
    Francis avatar
    10 posts
    Member since:
    Mar 2016

    Posted 14 Mar Link to this post

    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? 
  8. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 17 Mar Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready