tinymce: clear field

Categories: javascript, ajax, tinymce

Tags: clear, tinymce, xajax

the normal way to clear <textarea> field:

Code:

document.formname.textareaid.value = '';

for <textarea> converted into tinymce editor, the above javascript call does not work. you need to call tinyMCE.setContent()

Code:

tinyMCE.getInstanceById('textareaid').setContent('');

to call from xajax function:

Code:

$xajax->script("tinyMCE.getInstanceById('textareaid').setContent('');");

tinymce and xajax: data in the editor is not submitted

Categories: javascript, html, ajax, tinymce

Tags: post, save, tinymce

i just downloaded and installed tinymce which magically converted the <textarea> element into a nice little editor, which supposely transform the input into html output. nice! no more educating non-programmers about html tags.

if you submit the form via normal post, the value for <textarea> form element is submitted. but when submitting the form via xajax, the data for the <textarea> element is empty!

after some research around the internet, found out that the solution is easy. before submitting the form, call tinyMCE.triggerSave().

more about tinymce and xajax here.


tinymce: html wysiwyg editor

Categories: javascript, html, bookmark, free, tinymce

Tags: editor, tinymce

if you’re not using any standard packages (portals, cms etc) and want to write your own form for users who don’t know anything about html to post html contents, one solution is to use tinyMCE, an open source (ie free!) javascript that transform <textarea> element into a wysiwyg editor.

have a look at the examples.

it’s relatively easy to use, if you just want a simiple editor. more advanced iimplementations require a bit of learning curves. it’s well documented in its wiki pages.


Affliates

Spreadfirefox Affiliate Button