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.
The issue comes from tinymce hiding the textarea. Remove the required attribute and it should be fixed!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With