1

I have a textarea in a hidden display table (it's a long form with many options). If the user open the section I change the style display and initialise an instance of TinyMCE. (I have tried to init it when the table is hidden but this don't work)

My text area:

<table width="100%" id="tbl_desc_sel" style="display:none;">
<tr>
  <td>
        <textarea cols="65" rows="10" id="MY_DESC" name="MY_DESC"></textarea>

  </td>
</tr>
</table>

The form is posted using jQuery.AJAX type=POST, I use this to retrieve the content in my JS validation form:

jQuery('#MY_DESC').html( tinyMCE.get('MY_DESC').getContent() );

But when the section is closed again (after filling some content), the retrieved content is empty ... if the section is open it work fine.

Any id to resolve the problem ?

Tanks for your help.

Boody
  • 35
  • 1
  • 6

2 Answers2

0

But when the section is closed again (after filling some content), the retrieved content is empty ... if the section is open it work fine.

Of course this is so. When there is no editor you cannot get any content of it.

Thariama
  • 50,002
  • 13
  • 138
  • 166
  • @ Thariama: But if the form is submit in an normal way the hidden content is retrieved, it's only empty in AJAX submit way. – Boody Jun 04 '13 at 08:01
  • @Boody: can you explicitly/exactly describe what happens? – Thariama Jun 04 '13 at 08:04
  • @ Thariama: if the display is hidden the `tinyMCE.get('MY_DESC').getContent()` is empty (no error, just empty content). – Boody Jun 04 '13 at 08:08
  • @ Thariama: the editor is in a `` which can be hidden by the user (`display:none`), if the table is in hidden mode the content of the editor (`tinyMCE.get('MY_DESC').getContent()`) is empty. If the display is block then the content is retrieved.
    – Boody Jun 04 '13 at 13:08
  • you could try to get the content using tinyMCE.get('MY_DESC').getBody().innerHTML – Thariama Jun 04 '13 at 14:22
0

I resolved my problem using the jQuery plugin for the editor.

I'm now able to init the TinyMCE editor on a style="display:none;" <textearea> and post trough AJAX the content even if this <textearea> is hidden.

Boody
  • 35
  • 1
  • 6