Im trying to use the Yahoo rich text editor in my web application. I'm kind of new to web programming so this may be a silly question.
I'm using a custom model called "blogpost". It contains the following properties:
Title Body DateCreated Author
I want to use the custom editor for only the "body" property. When I click submit it will build the other properties of the model from simple textboxes. I have placed the following code withing my input form code.
<div class="yui-skin-sam">
<textarea name= "msgpost" id="msgpost" cols="50" rows="10">
</textarea>
<script>
var myEditor = new YAHOO.widget.Editor('msgpost', {
height: '300px',
width: '522px',
dompath: true, //Turns on the bar at the bottom
animate: true //Animates the opening, closing and moving of Editor windows
});
myEditor.render();
YAHOO.util.Event.on('Create', 'click', function () {
myEditor.saveHTML();
var body = myEditor.get('element').value;
});
</script>
@ViewData.Add("Body",//how do I add the javascript variable "body" ?)
</div>
How do I "post" the javascript variable "body" so the MVC model builder recognizes it?