<EditForm class="form" Model="reg" OnValidSubmit="Submit">
<DataAnnotationsValidator />
<ValidationSummary />
<label>Name of the company:</label> <InputText class="field" @bind-Value="reg.Firm"> <br />
@for (int i = 0; i < people; i++)
{
<h4>@(i + 1). Person</h4>
@AddPersonIfNeeded();
<div class="form">
<label>Fullname:</label> <InputText class="field" @bind-Value="reg.People[0].FullName" /> <br />
<label>Email:</label> <InputText class="field" @bind-Value="reg.People[0].Email"/> <br />
</div>
}
<button type="button" class="button" onclick="@(() => { people++; })">Add new person</button>
<button type="submit" class="button">Submit</button>
</EditForm>
<EditForm class="form" Model="reg" OnValidSubmit="Submit">
<DataAnnotationsValidator />
<ValidationSummary />
<label>Name of the company:</label> <InputText class="field" @bind-Value="reg.Firm"> <br />
@for (int i = 0; i < people; i++)
{
<h4>@(i + 1). Person</h4>
@AddPersonIfNeeded();
<div class="form">
<label>Fullname:</label> <InputText class="field" @bind-Value="reg.People[0].FullName" /> <br />
<label>Email:</label> <InputText class="field" @bind-Value="reg.People[0].Email"/> <br />
</div>
}
<button type="button" class="button" onclick="@(() => { people++; })">Add new person</button>
<button type="submit" class="button">Submit</button>
</EditForm>