Search code examples
quill

How to make quill editor required?


How to make the quill editor field required? The editor gets rendered into a div, but it isn't clear if there is a way to make the field/editor required when the form submits.


Solution

  • As you wrote, Quill works with a div and not with a form element so it can't help you with form validation. You'll need to check manually if the editor's content is empty, prevent the user from submitting the form and show a message that this field is required.

    You can copy quill contents to a hidden input element before submitting the form as shown in this example.