# Tiny mce and link to remote

**URL:** <https://www.ruby-forum.com/t/tiny-mce-and-link-to-remote/184795>\
**Category:** Rails\
**Created:** [March 8, 2010, 7:58pm UTC](https://www.ruby-forum.com/t/tiny-mce-and-link-to-remote/184795 "2010-03-08T19:58:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [March 8, 2010, 7:58pm UTC](https://www.ruby-forum.com/t/tiny-mce-and-link-to-remote/184795/1 "2010-03-08T19:58:51Z")

</div>

I uses tiny mce in my rails application successfully, but when I try  
to use it in a form\_for on a page that have been loaded by  
link\_to\_remote tiny mce does not work any more.  
How to solve this problem ?  
Any other html editor that may work in this situation. I tried  
fckeditor, but the problem was the same.  
How about the tiny mce plugin at git://github.com/kete/tiny\_mce.gi?  
I am not using the plugin but tiny mce directly.

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [March 10, 2010, 10:19pm UTC](https://www.ruby-forum.com/t/tiny-mce-and-link-to-remote/184795/2 "2010-03-10T22:19:41Z")

</div>

You’ll probably find that most editors have this issue.

When you insert a textarea into the page via an AJAX call, you must  
readd that editor to the textareas.

The easiest way is the have some Javascript like this:

function init\_wysiwyg\_editor() {

# the editor initialize code

}

then on any partial you render via AJAX, make sure it is set to  
eval\_scripts, and add this at the end of the partial.

Regards  
Kieran

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [March 10, 2010, 10:50pm UTC](https://www.ruby-forum.com/t/tiny-mce-and-link-to-remote/184795/3 "2010-03-10T22:50:06Z")

</div>

If I remember correctly, tinyMCE is static and won’t work with dynamic  
changes of page content. In other words, your ajax result is unknown  
to tinyMCE. A work around might be that you need to load tinyMCE at  
the same time you get the result from ajax. I think I did this a long  
time before by putting the part of the loading mce part of js in a  
partial, and then put the partial as part of another partial that ajax  
renders.
