❔ OnSubmit in ASP.NET EditForm is not triggering debugger in VS

I have
@page "/form-example-1"
@using Microsoft.Extensions.Logging
@using BookGroup.Models
@inject ILogger<SubmitPostModal> Logger
@using Microsoft.AspNetCore.Components.Forms

<div class="modal fade center" tabindex="-1" role="dialog" id="add-post-modal">
<div class="modal-content">
<EditForm Model="@examplePost" OnSubmit="@HandleSubmit">
<InputText id="inputQuote" @bind-Value="examplePost.Quote" />
<button type="submit">Submit</button>
</EditForm>
</div>
</div>


@code {
private BookGroup.Models.Post examplePost = new BookGroup.Models.Post();

private void HandleSubmit()
{
Logger.LogInformation("HandleSubmit called");

// Process the form
}
}
@page "/form-example-1"
@using Microsoft.Extensions.Logging
@using BookGroup.Models
@inject ILogger<SubmitPostModal> Logger
@using Microsoft.AspNetCore.Components.Forms

<div class="modal fade center" tabindex="-1" role="dialog" id="add-post-modal">
<div class="modal-content">
<EditForm Model="@examplePost" OnSubmit="@HandleSubmit">
<InputText id="inputQuote" @bind-Value="examplePost.Quote" />
<button type="submit">Submit</button>
</EditForm>
</div>
</div>


@code {
private BookGroup.Models.Post examplePost = new BookGroup.Models.Post();

private void HandleSubmit()
{
Logger.LogInformation("HandleSubmit called");

// Process the form
}
}
And when I press the "submit" button, nothing happens when I put a debug on the Logger so I assume that no event is being fired.
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server