I'm trying to add a 'save as draft' button to a mail sending form,
when the user clicks on that button, i send the form data to the
server by ajax to save it, but my problem is there's a rich edit that
i cant get its value.

Here's my textarea:
<textarea name="body" id="i_body"></textarea>
Using this code:
console.log($('#i_body').val());
It returns exactly what i have in the textarea: that's OK !

Now, i switch to richedit, my textarea becomes like this:
<script type="text/javascript">
//<![CDATA[
tinyMCE.init({
  mode: "exact",
  language: "en",
  elements: "i_body",
  plugins: "table,advimage,advlink,flash",
  theme: "advanced",
  theme_advanced_toolbar_location: "top",
  theme_advanced_toolbar_align: "left",
  theme_advanced_path_location: "bottom",
  theme_advanced_buttons1:
"justifyleft,justifycenter,justifyright,justifyfull,separator,bold,italic,strikethrough,separator,sub,sup,separator,charmap",
  theme_advanced_buttons2:
"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,image,flash,separator,cleanup,removeformat,separator,code",
  theme_advanced_buttons3: "tablecontrols",
  extended_valid_elements: "img[class|src|border=0|alt|title|hspace|
vspace|width|height|align|onmouseover|onmouseout|name]",
  relative_urls: false,
  debug: false
});
//]]>
</script><textarea name="body" id="i_body" class="rich"></textarea>
and using this code:
console.log($('#i_body').val());
It returns an empty string, even if i type something in my richeditor.

For information, if i submit my form (normally and not with Ajax), i
get the right value for my richedit.

Reply via email to