Send data empty when wysiwyg used in a modal window
Alex-CodeLab opened this issue · comments
When I'm using my form in a bootstrap3 modal window the data in the POST request does not contain the content I just typed into the wysiwyg text field. The POST data shows the field is just empty. Other fields are send just fine, and when wysiwyg is removed the same text field also works just fine.
(using django-fm for the modal window, but that should not make a difference)
The problem is that the wysiwyg editor is already applied, but then the HTML is wrapped/changed/relocated to open the model dialog.
Instead of using the template tag to activate the wysiwyg editor, only load it (the setup call), and use the JavaScript API after opening the dialog. You could use something like:
if (django_wysiwyg.is_loaded()) {
var textareas = $("textarea").toArray();
for (var i = 0; i < textareas.length; i++) {
var textarea = textareas[i];
django_wysiwyg.enable("e:" + textarea.name, textarea.id);
}
}