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

Avoid browser sugestions

I'm facing a problem with browser autocomplete. If I use in my Autocomplete a Placeholder that the browser recognize as form field it knows, it (the browser) put a list over my Autocomplete list.

How can I avoid it?


Attachment: Autocomplete_fc034578.zip

1 Reply

SP Sureshkumar P Syncfusion Team March 21, 2023 10:28 AM UTC

Hi Társis,

Based on your shared information with image. In out autocomplete has already set the autocomplete attribute value as off to resolve your facing issue. But if still you have faced the same issue then we suggest you use the htmlattributes property to set the autocomplete attribute value as off to resolve the facing issue from your application.

Find the code example here:

<EditForm Model="@model" OnValidSubmit="SubmitHandler" OnInvalidSubmit="InValidHanlder">

    <DataAnnotationsValidator />

    <h5>TextBox : @model.Password</h5>

    <SfTextBox ID="email" Type="InputType.Email" @bind-Value="@model.Password" HtmlAttributes="@(new Dictionary<string,object>() { { "name", "email" } })"></SfTextBox>

    <ValidationMessage For="() => model.Password" />

       <h5>Autocomplete : @model.Name</h5>

    <SfAutoComplete ID="Username" Autofill=true TValue="string" Placeholder="e.g. Australia" TItem="Countries" @bind-Value="@model.Name" DataSource="@Country" HtmlAttributes="@(new Dictionary<string,object>() { { "name", "Username"}, {"type", "Username"}, {"autocomplete", "off"} })">

        <AutoCompleteFieldSettings Text="Name" Value="Code"></AutoCompleteFieldSettings>

       </SfAutoComplete>

       <ValidationMessage For="() => model.Name" />

       <SfButton CssClass="e-small e-info" Type="submit" Content="Submit"></SfButton>

</EditForm>

 

@code {

    public class CountriesModel

    {

        [Required]

        public string Name { get; set; }

        [Required]

        public string Password { get; set; }

    }

    public CountriesModel model = new CountriesModel();

    void InValidHanlder()

    {

        StateHasChanged();

    }

    void SubmitHandler()

    {

        StateHasChanged();

    }

 

    public class Countries

    {

        public string Name { get; set; }

 

        public string Code { get; set; }

    }

 

    List<Countries> Country = new List<Countries>

{

        new Countries() { Name = "Australia", Code = "AU" },

        new Countries() { Name = "Bermuda", Code = "BM" },

        new Countries() { Name = "Canada", Code = "CA" },

        new Countries() { Name = "Cameroon", Code = "CM" },

    };

 

}

 


Find the sample here in the attachment:

Regards,

Sureshkumar P


Attachment: DDLServer_8cf14c3d.zip

Loader.
Up arrow icon