Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make quill editor required?

Tags:

quill

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.

like image 461
user1669296 Avatar asked Oct 30 '22 07:10

user1669296


1 Answers

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.

like image 84
Ben Browitt Avatar answered Jan 02 '23 19:01

Ben Browitt