I’m trying to use a tinyMCE text editor in my Rails app and am having
some problems. I’m trying to load a tinyMCE-enabled form dynamically
as the result of an Ajax call, i.e. I want to insert the form into a
page via Ajax. The Ajax stuff is handled by the Mootools framework.
There’s a few posts about this out there, but none of them seem to
work for me.
The code I have behaves as follows:
Define a function init_mce() to call the tinyMCE.init() function:
In the onComplete callback of my ajax request, call init_mce();
- Replace the content of a div with a form:
<% remote_form_for :text, :url => some_url, :before =>
“tinyMCE.triggerSave();” do |f| %>
<%= f.text_area :body, :style => “width:100%;height:100%;”, :id =>
“for_mce”, :class => “for_mce” %>
<%= submit_tag “Save” -%>
<% end -%>
- Activate the control and set it to send an ajax request rather than
a normal submit:
Sadly, this doesn’t work. Has anyone found a working solution to this?