Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE - An invalid form control with name='content' is not focusable

I use TinyMCE 4 and this is my code for it:

<script type="text/javascript" src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
       tinymce.init({
         selector: 'textarea[name=content]',
         plugins: 'image code',
         toolbar: 'undo redo | link image | code',
         image_title: true, 
         automatic_uploads: true,
         file_picker_types: 'image', 
         file_picker_callback: function(cb, value, meta) {
           var input = document.createElement('input');
           input.setAttribute('type', 'file');
           input.setAttribute('accept', 'image/*');
           input.onchange = function() {
             var file = this.files[0];
             var reader = new FileReader();
             reader.onload = function () {
             var id = 'blobid' + (new Date()).getTime();
             var blobCache =  tinymce.activeEditor.editorUpload.blobCache;
             var base64 = reader.result.split(',')[1];
             var blobInfo = blobCache.create(id, file, base64);
             blobCache.add(blobInfo);
             cb(blobInfo.blobUri(), { title: file.name });
           };
           reader.readAsDataURL(file);
         };
         input.click();
       }
     });  
</script>

and I have one problem. When I click on the "submit" button, the form isn' t send but in web browser console I have error: "An invalid form control with name='content' is not focusable."

Please can you help me, how can I solve this problem simply? For all advice thanks in advance.

like image 339
michal s Avatar asked Dec 19 '22 01:12

michal s


1 Answers

The issue comes from tinymce hiding the textarea. Remove the required attribute and it should be fixed!

like image 85
Ivo Avatar answered Dec 28 '22 06:12

Ivo