1

I have a textarea which is a tinymce editor. This text area contains html. I think i need to do something like this in jquery...

var str = $("#emailMessage").serialize();
$("#emailMessage").text(str);

How can I convert this back to markup at my mvc controller?

Thanks.

tereško
  • 58,060
  • 25
  • 98
  • 150
gilbert
  • 308
  • 5
  • 16
  • Why do you think you have to do that? (You don't.) (Also, to set the value of a ` – Pointy Nov 02 '11 at 16:36
  • Isn't passing raw HTML back and forth from the controller a security concern? It seems like user entered special characters ', <, /, #, etc would need to be encoded to guard against Javascript injection. Maybe tinymce somehow handles this, I haven't used it before. – Evan Nov 02 '11 at 16:42

1 Answers1

0

If you are using the jquery tinymce plugin you don't have to do anything but submitting the form. It transforms the $("textarea").val() into the value of the tinymce editor

Manuel van Rijn
  • 10,170
  • 1
  • 29
  • 52
  • 1
    when i do alert($("#emailMessage").val()); i can see the html in the text area just fine, but the ajax form post never reaches my controller. If the text area is empty, the post hits the controller just fine and all other form values are there. – gilbert Nov 03 '11 at 08:37
  • ok now i get it. Have a look at this article http://stackoverflow.com/questions/2122085/problem-jquery-and-tinymce-textarea-value-doesnt-submit maybe here's a solution for your POST problem – Manuel van Rijn Nov 03 '11 at 10:02