What I would like to create:
I would create a Blazor server-side page that contains data. Some of these data are read-only so the user can only see them. Other data can be modified by the user so he will modify them through an EditForm.
I wouldn't insert a submit button inside the EditForm instead, I would like to create a buttons bar that contains some buttons that the user can click. One of them would be Save all button. When the user clicks over it, that button have to call EditForm validate() function to verify if the data contained inside the EditForm is still valid or not.
Is it possible?
<button @onclick="Foo">click me</button>
<EditForm Model="@_exampleModel" OnValidSubmit="HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<InputText id="name" @bind-Value="_exampleModel.Name" />
</EditForm>
@code {
private ExampleModel _exampleModel = new ExampleModel();
private void HandleValidSubmit()
{
Console.WriteLine("OnValidSubmit");
}
private void Foo()
{
//how can I call EditForm validate method?
}
}