public class EmailLeads : HydroComponent
{
public string? AlertClass { get; set; }
public string? Message { get; set; }
[Required(ErrorMessage = "Email is required")]
public string? Email { get; set; } = default!;
public async Task SubmitAsync()
{
//if (!ModelState.IsValid) return;
if (!Validate()) return;
// stuff happens in db
}
}
The problem is after I fill in a value and click Submit, the validation has not refreshed, and Validate returns false.
I put a breakpoint in my Submit method, and I check the value of Email property, and I see it's null. Do I need to put some other binding event on my html input?
hello! I'm having trouble using form validation. When I submit a form with a require field missing, I get a validation error as expected.
Here's my form markup:
and relevant part of model class
The problem is after I fill in a value and click Submit, the validation has not refreshed, and
Validate
returns false. I put a breakpoint in my Submit method, and I check the value ofEmail
property, and I see it's null. Do I need to put some other binding event on my html input?