HTML5 validation with required doesn't show error
See original GitHub issuesteps to reproduce
- Create `<textarea name="source" required="required"></textarea>
- Bind summernote.
- Send form without filling editor.
browser version and os version and summernote version
What is your browser and OS? All HTML5 validation enabled browsers What is your summernote version? 0.8.8
problem description
When textarea was defined as required
, HTML5 validation fails without any notification when editor is not filled. This is caused because HTML5 validation is triggered on source <textarea style="display: none;">
which is not focusable. You can read Chrome error in console:
An invalid form control with name='source' is not focusable.
TODO:
- When source textarea is marked as
required
– remove it from source element and add it to target textarea element.
but it won’t solve problem
textarea.note-codable
is also not focusable! So even if you rewriterequired
attr by hand –it won’t show up for Summernote editor.
Similar implementation from other editor: https://github.com/ckeditor/ckeditor-dev/commit/385a822
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:16 (13 by maintainers)
Top Results From Across the Web
6 Reasons - HTML5 Required Attribute Validation not Working
1. The Form Tag has “novalidate” Attribute · 2. Required Attribute Validation doesn't Work with Unclosed Input Tags · 3. The Button is...
Read more >HTML5 Form Validation - Showing All Error Messages
HTML5 required validation example Open in New Window. Name: Comments: ... Let's see how this can be leveraged to show all error messages....
Read more >HTML5 Form validation message doesn't show when scroll ...
If the first error field is outside of the viewport then on validation, the document scrolls up and focusses on the field however...
Read more >Client-side form validation - Learn web development | MDN
What is form validation? ... Go to any popular site with a registration form, and you will notice that they provide feedback when...
Read more >HTML5 Form Validation Examples < HTML - The Art of Web
Different browsers may mark the input box in some way (Firefox 4 Beta adds a red box-shadow by default), display a warning (Opera)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1
use: $(‘#Post’).summernote(‘isEmpty’) || $($(“#Post”).summernote(“code”)).text().trim() == ‘’
Exemple:
$(‘.btn-create’).on(‘click’, function () { var submeterForm = 1; if ($(‘#Post’).summernote(‘isEmpty’) || $($(“#Post”).summernote(“code”)).text().trim() == ‘’) { submeterForm = 0; } if (submeterForm <= 0) { $(‘span[data-valmsg-for=“Post”]’).text(“* Input Required!”); } else { $(‘#form-post’).submit(); } });