using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;

namespace CollAction.ValidationAttributes
{
    public class RichTextRequiredAttribute : ValidationAttribute, IClientModelValidator
    {
        public void AddValidation(ClientModelValidationContext context)
        {
            context.Attributes["data-val"] = "true";
            context.Attributes["data-val-richtextrequired"] = ErrorMessage ?? $"{context.ModelMetadata.DisplayName} is required";
        }
    }
}
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;

namespace CollAction.ValidationAttributes
{
    public class RichTextRequiredAttribute : RequiredAttribute, IClientModelValidator
    {        
        public void AddValidation(ClientModelValidationContext context)
        {
            var requiredMessage = ErrorMessage ?? $"{context.ModelMetadata.DisplayName} is required";
            context.Attributes["data-val"] = "true";
            context.Attributes["data-val-required"] = requiredMessage;
            context.Attributes["data-val-richtextrequired"] = requiredMessage;
        }
    }
}
Add required validation for rich text components on server side
Add required validation for rich text components on server side
