1
votes

I have legacy rails 3 app, where I need to modify a page to use tinymce to edit a text_area. There are existing pages in this app that already use tinymce. For reasons I cannot go into here, I cannot use any of the tinymce plugins that are available.

Now my problem is as follows. I have a model called Sections, that has two attributes, section_name and html. I want to be able to edit the html using tinymce. My view has a form which is as follows

<%= form_for @section , :url => update_section_path , :method => :put do |f| %>
    <%= f.hidden_field :id %>
<%= f.label :section_name , "Section Name" %>
    <%= f.text_field :section_name %> <br />
    <%= f.label :html, "Html" %>
<%= f.text_area :html %>
<%= f.submit "Update" %>
<% end %>

The form appears as expected. The TinyMCE editor also appears on the page with the original html. The problem is that when I click on the Update button, the put query sent to my server, does not contain the new modified content of the Html text_area. It sends back the original text that was in that text_area.

Could anyone help me understand why.

Thanks in advance

=Puneet

1
If you've altered any of the form submission code then you may need to run the tinymce.activeEditor.save() method prior to the submit to ensure that Tiny has updated the textarea. Check out tinymce.com/wiki.php/API3:method.tinymce.Editor.save for details. - Brett Henderson
Im not really sure if the form submission code is altered. How do I tell if the form submission code is altered. - ppaul74

1 Answers

0
votes

I found an issue in my html which was causing this. Once I fixed that issue it worked fine