Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5981431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:56:34+00:00 2026-05-22T21:56:34+00:00

Im trying to use the Yahoo rich text editor in my web application. I’m

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:56:35+00:00Added an answer on May 22, 2026 at 9:56 pm

    You can’t do this in your MVC View. You need to do it in javascript.

    You’ll need to hook the Submit event on the form and then get the value of the text in the editor, and add it to the post data. Something like:

    $('form').submit(function(event){
        // cancel the default action
        event.preventDefault();
        var body = escape(myEditor.get('element').value);
    
        var theForm = $(this);
        $.post(theForm.attr('action'), theForm.serialize() + '&body=' + body, function (data) {
            // do whatever with the result
        });
    });
    

    Another way to do it would be to add a hidden field to your form and update that field with the value of the editor:

    <input id="body" name="body" type="hidden" value=""/>
    

    then instead of setting the body variable you can do this:

    YAHOO.util.Event.on('Create', 'click', function () {
        myEditor.saveHTML();
        $('#body').attr('value', myEditor.get('element').value);
    }); 
    

    Then the data is in the form and the form will handle the rest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Yahoo Local Search in a Kynetx Application. ruleset avogadro {
I am trying to use this function to pull data from Foursquare through yahoo
I'm trying to use Yahoo Pipes to solve the feedback loop of Buzz ->
I'm trying to track an event in my app using Yahoo Web Analytics. The
I am trying to make use of the yahoo exceptional performance rule : avoiding
Im trying to use http://www.javarants.com/2008/04/13/using-google-app-engine-to-extend-yahoo-pipes/ as inspiration, but I'm having some troubles with the
http://developer.yahoo.com/yui/datasource/#events I'm trying to use the responseParseEvent but I don't know how to hook
I'm trying use rich:suggestionbox . I went through the tutorial provided by the Richfaces.
I'm trying to use the Yahoo Social Python SDK to get a users contacts
I'm trying to build a web app that grabs fantasy sports info from Yahoo's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.