TextBox autocomplete attribute gets set to 'off'

1 Answer 14 Views
TextBox
Nikita
Top achievements
Rank 1
Nikita asked on 13 Oct 2021, 06:43 PM
I want browsers to offer autocomplete suggestions for a kendo TextBox I have on a form, but it always renders with autocomplete="off" no matter what I set it to in HtmlAttributes config. How do I make it work?

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 18 Oct 2021, 01:27 PM

Hello Nikita,

 

Thank you for writing to us.

Generally, we have the AutoCompleteBox specifically for similar cases:
https://demos.telerik.com/aspnet-mvc/autocomplete

If you prefer to keep the TextBox instead, you can use the following solution which will fix the override:

@(Html.Kendo().TextBox()
        .Name("textbox")
        .HtmlAttributes(new {
            style = "width: 70%",
            @class = "autocomplete-input"
        })
    )
<script>
    $(document).ready(function () {
        $(".autocomplete-input").attr("autocomplete", "on");
    });
</script>
Feel free to give this a try and let me know if it helps you.

 

Regards,
Eyup
Progress Telerik

Remote troubleshooting is now easier with Telerik Fiddler Jam. Get the full context to end-users' issues in just three steps! Start your trial here - https://www.telerik.com/fiddler-jam.
Nikita
Top achievements
Rank 1
commented on 26 Oct 2021, 08:32 PM

Hello Eyup, thank you for your answer. From what I understand the AutoCompleteBox is designed to offer autocomplete suggestions from a specified data source. I'm looking to use the browsers' feature that provides suggestions from cached user input. I'll try the attribute setting option you provided.
Eyup
Telerik team
commented on 29 Oct 2021, 11:26 AM

Yes, this is exactly right.

I hope it will prove helpful to you.

Tags
TextBox
Asked by
Nikita
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or