I have a Blazor form on a .RAZOR page:
<EditForm Model="@myModel" OnValidSubmit="@doThis"><InputCheckbox class="someClass" id="someId" @bind-value="booleanValue" @onchange="e=>{doSomething(e);}"></InputCheckbox></EditForm>@code { public MyModel myModel = new MyModel(); public bool booleanValue = true; public void doSomething(ChangeEventArgs e) { // Stuff here ... } public async Task doThis(){ // Stuff here ... }}When I put a breakpoint at public void DoSomething it never gets hit.
However, if I change the @onchange to @onclick, the public void DoSomething method gets hit every time. The only thing is that the @onclick doesn't let me know what has changed, meaning "is it clicked -to-> unclicked or is it unclicked -to-> clicked".
So, why is the @onchange event never firing, and how can I get it to work?