1

I'm trying to display a custom error message for required fields in my asp.net core project. All my other custom error messages seem to be working fine, but the default error message still appears for my required field.

This is what I have in my view model:

[Required(ErrorMessage = "Please enter a bid!")]
[Range(0.00, 1000000000000, ErrorMessage="Starting bid cannot be 
less than 0!")]
public decimal Amount {get;set;}

On my html page the custom error message for range appears when I enter a negative value, but when I submit a blank form, I get the default error message: 'the value '' is invalid'. I've looked through stack overflow and from what I've gathered custom error messages are no different for required fields. None of them are working in any of my view models, but every other type of validation is. What am I missing?

jsimpson91
  • 23
  • 4

0 Answers0