I have a textarea which i want to set it to required. I'm trying to use the rulefor from the fluentvalidation but still not happening something.
i have try also too to use the [required] etc. Someone can give me a hand with this?
Here is my code:
Model:
public class MainValidator : AbstractValidator<Main>
{
public MainValidator()
{
RuleFor(x => x.Message).NotEmpty().WithMessage("Required field");
}
}
View:
<textarea id="message" name="message"></textarea>