<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" },
};
}
|