BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
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?
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