How do I grab the data in my textarea and stuff it in my model?
I'm in a Create() View, and I want to access the model, to put the contents of a
<textarea>
into one of the model's properties, the Content property in this case.
namespace TestTinyMCE.Models {
public class TestBlog {
public int TestBlogId { get; set; }
public string Title { get; set; }
public DateTime PostedOn { get; set; }
public string Tags { get; set; }
public string Content { get; set; }
}
}
I can't use TextAreaFor as I'm accepting HTML markup (bold, italic, and so on). I'm using TinyMCE on my textarea if that matters.
I tried hooking the submit event via JQuery's .submit API:
<script type="text/javascript">
$(document).ready(function () {
tinyMCE.init({
theme: "advanced",
mode: "textareas"
});
$('#contentEditor').submit(function () {
alert('Handler for .submit() called.');
return false;
});
});
</script>
but while the .submit() occurred in $(document).ready, the handler itself never fires off.
and here's my textarea:
<div class="editor-field">
<textarea id="contentEditor" name="contentEditor"></textarea>
</div>