Tuesday, December 19, 2006

TinyMCE + AJAX

I was working on a web application form where I need to use TinyMCE instead of textarea with AJAX request.
but the value of the textarea does not send the new entered value.
ok, what is the problem?

if you viewed the DOM tree of the tinyMCE you will notice that it's actually an IFrame which make it hard to send the data via AJAX request.

what is solution?
on the form's submit button: I added the following:
onclick="tinyMCE.triggerSave(true,true);"

for more details refer to http://www.crossedconnections.org/w/?p=88



3 comments:

Anonymous said...

Thankyou... many many thankyou.
I am building a form validation with AJAX and PHP and i have that problem.

I am lucky. I find your solution in the first result of Google.

Anonymous said...

hey Dwairi,
Thanks a ton man! It works! I was trying to use
tinyMCE.execCommand('mceRemoveControl',false,'explanation');

but your suggestion did the trick!

Thanks again man! :)

Regan Rajan said...

thanks man! it helped!