Reputation: 2532
I use in the project Froala. The textarea element is in the form to be sent to the server. I add any text to Froala and click the submit form button. But the textarea field on the server is empty(NULL). I think I need to call the Froala method to prepare the textarea before submitting the form to the server, but I do not know which one.
What could be the problem?
View
@using (Html.BeginForm("UpdatePost", "Post", FormMethod.Post, new { id = "postForm" }))
{
<textarea id="PreviewText" name="PreviewText"></textarea>
<button class="btn btn-success w-100">Save</button>
}
Server
[HttpPost]
public JObject UpdatePost([FromForm] Post postForm)
{
//...
}
Javascript
$('#PreviewText').froalaEditor({
language: 'ru',
imageUploadURL: '../UploadImage',
imageUploadParams: {
postId: Tmigin.CMS.PostEditor.postId
},
imageManagerLoadURL: '../LoadImages',
imageManagerLoadParams: {
postId: Tmigin.CMS.PostEditor.postId
},
imageManagerDeleteURL: '../DeleteImage',
imageManagerDeleteParams: {
postId: Tmigin.CMS.PostEditor.postId
}
});
Update Similar problems in the compatibility of jQuery Form Plugin and Froala.
Fixed
https://github.com/froala/wysiwyg-editor/issues/2233
Upvotes: 0
Views: 2564
Reputation: 9525
As per your note on this issue on the Froala github issues page,
If before sending to the form server, you call this:
$('#PreviewText').froalaEditor('events.trigger', 'blur');
then you can get values from the editor.
Copied here to assist others who may not find your note on github.
Upvotes: 1