Inline Editor Value Is Not Posted to the Server
Environment
Product | Progress® Kendo UI® Editor for jQuery |
Operating System | Windows 10 64bit |
Description
The inline jQuery Editor value is not posted to the server.
Cause
Because the inline Editor is initialized from a non-form
element, it is not posted to the server by design.
Solution
To submit the value of the Editor along with the form
, use the approach demonstrated in the following example.
<form>
<div id="comment" contentEditable></div>
<button class="k-button">Submit</button>
</form>
<script>
$("form").on("submit", function() {
var form = $(this);
// For each Editor in the form...
form.find("[data-role=editor]").each(function() {
var editor = $(this).data("kendoEditor");
// ... append a hidden input that holds the Editor value.
$("<input type='hidden' />")
.attr("name", editor.element.attr("id"))
.val(editor.value())
.appendTo(form);
});
});
</script>