php - DB content not coming into tinyMCE textarea
My tinyMCE editor is showing up just fine, but in the form I have a select box and according to what you choose, the textarea is filled with content accordingly.
Like if I choose PHP, then the description for PHP comes into the textarea. It works without tinyMCE, but when I add tinyMCE, nothing shows up in the textarea.
Answer
Solution:
TinyMCE does not display the content of the textarea in real-time. It reads the content on start, and saves it at the end of the work. All the edit work takes place in an
iframe
element, created on the fly by Tiny. If you update thetextarea
, you must ask TinyMCE to refresh itself.In a few minutes I will look up the exact method for you. (It was long time ago when I was using TinyMCE, so I forgot the method names.)
[few minutes have passed..]
Look at the documentation: http://www.tinymce.com/wiki.php/How-to_load/save_with_Ajax_in_TinyMCE
You just need to call setContent method on the TinyMCE editor, instead of (or in addition to) setting the new text in the
textarea
.Answer
Solution:
with tiny mce sometimes it dependes the plugins that you in the Init. Try Removing all the plugins and add one by one and see if this helps you in finding a better solution for this.
Some plugins like the media can strip and not allow tags in the text area, so the textarea is empty if tiny mce doens't allow that tags, or add valid_elemens:'[]' and try if it shows something.
Good luck