Setting required field in model does not work when in wysiwyg mode (it does when in source code mode). In wysiwyg mode <p> tags are inserted even if the text box is blank. Thus bypassing required field validation. Confirmed by using WebDeveloper F12 in Chrome. As a temporary , hack, work around I have to set a MinLength.
<EditForm Model="@Model" OnValidSubmit="@HandleSubmit">
<DataAnnotationsValidator />
<div class="form-group border rounded bg-light bg-opacity-25">
<SfRichTextEditor @bind-Value="Model.Announcement">
<RichTextEditorToolbarSettings Items="@Items" EnableFloating="false" />
</SfRichTextEditor>
<ValidationMessage For="@(() => Model.Announcement)" />
<button CssClass="e-primary" IconCss="fa fa-save">Update Announcement</button>
</div>
</EditForm>
---------------------------------------------------------------------------------------------------------------
[Required(ErrorMessage = "Announcement is Required.")]
[MinLength(12, ErrorMessage = "The minimum length of this field is {1} characters.")]
public string? Announcement { get; set; }
We are glad to announce that our Essential Studio 2022 Volume 2 SP release v20.2.0.43 is rolled out and is available for download under the following link.
We have also included the fix for the reported issue "Required field validation is not working properly with RTE inside EditForm" with our Vol 2 2022 SP release. So please upgrade your package to the latest to resolve the issue from your end.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you require any further assistance.
Regards,
Upgrading to 20.2.0.43 (all packages) does not resolve the issue "Required field validation is not working properly with RTE inside EditForm" (Preview mode) Even this RTE you have in this reply box does not seem to handle "Required field validation" , You have the same hack workaround that I do This field must contain more than five characters.
To replicate the problem , you can do one of two things.