I want to make a component that have a EditForm
and encapsulate the form and the validation inside of the component.
And I want to reuse this component
Instead of including the EditForm
in the component, create a component without the EditForm
and call a component's method on OnValidSubmit
<EditForm OnValidSubmit="HandleValidSubmit">
<FormContentComponent @ref="_formContent" />
<button type="submit">submit</button>
</EditForm>
@code {
private FormContentComponent _formContent;
private void HandleValidSubmit()
{
_formContent.HandleValidSubmit();
}
}