I'm trying to use Summernote as an enhanced textarea field in a form. When the form is submitted, I'm sending the $_POST
variable to my PHP backend. After some unexpected behavior I tried printing $_POST
and noticed that Summernote adds 2 field into it - the usual form field ("description" in this case) and "files". I haven't found this behavior documented anywhere and I'm not using any file uploads inside or outside Summernote so I believe it's either a weird bug or I made a mistake somewhere. I could easily work around this issue but I'm just wondering if I'm doing something wrong and/or if there's a way to prevent it from doing this.
I'm using PHP 7.1, BS4 version of Summernote 0.8.15 and I'm not getting any console errors.
HTML/PHP:
<div class="form-group">
<label for="summernote">Description</label>
<textarea name="description" id="summernote" class="form-control"></textarea>
</div>
...
<?php
if(!empty($_POST))
{
print_r($_POST); //Array ( other fields... [description] => test [files] => )
}
?>
JS:
$('#summernote').summernote({
height: 150,
toolbar: [
['style', ['bold', 'italic', 'underline']],
['fontsize', ['fontsize']],
['color', ['forecolor']],
['para', ['ul', 'ol', 'paragraph']]
],
fontSizes: ['14', '16', '18', '20', '24', '28', '32']
});