Skip to content
Advertisement

Why I can’t get a value of textarea from tinymce editor using FormData in Jquery plugin?

I’m using Jquery plugin with Tinymce editor to add some post data to Database using Codeigniter.

My Issue I can’t get all the value from textarea which i used Tinymce Editor but another field is working very well.

Here is my Tinymce editor

JavaScript

And This is my Jquery Plugin

JavaScript

The result I can’t get all the textarea value if I using Tinymce editor for array variable DD and description

enter image description here

Advertisement

Answer

It is likely that you need to update the <textarea> with the contents of the editor before you capture the form’s data. I am guessing, and so assume you are grabbing the field values when you create the FormData object.

If that is true, then somewhere in the FormData constructor move the tinymce editor contents to the <textarea> by calling tinymce.Editor.save(). For instance, if your activeEditor instance is referenced in a var named editor then editor.save() will update the associated <textarea> element .

After that you can grab the value of the field using the JQuery .val() function, ie. someVar = $(#fieldName).val(); Obviously, you need to provide the appropriate names in place of someVar and #fieldName.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement