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

  • SEARCH
  • Home
  • 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 6344791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:42:35+00:00 2026-05-24T20:42:35+00:00

Today, for the first time, I came across the YUI 2 Rich Text Editor

  • 0

Today, for the first time, I came across the YUI 2 Rich Text Editor. (http://developer.yahoo.com/yui/editor/)

I mainly use Java Server Pages for my websites.

I want to be able to set the text in the textarea of the Editor to a previously submitted value. As an example, when a user submits the page, after having entered text in the Editor, that text may be saved in a database for future use. I would then call the value from the database, and set the Editor to display it at that point, so the user could make modifications.

I found a method in the API documentation called setEditorHTML() – but for some reason or another, I can’t get it to work.

Here is the test code I’ve been playing around with. I’m testing in Firefox.

I don’t understand why the setEditorHTML method won’t work…can someone please assist me?

<html>

<head>

<% String editorText = (String)session.getAttribute("editorText"); %>


<!-- Individual YUI CSS files -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/assets/skins/sam/skin.css">
<!-- Individual YUI JS files -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>

<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/element/element-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/container/container_core-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/menu/menu-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/button/button-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/slider/slider-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/colorpicker/colorpicker-min.js"></script>

<script type="text/javascript" src="Yahoo-YUI-editor/editor-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/layout/layout-min.js"></script>


<script language="javascript">
var myEditor = new YAHOO.widget.Editor('msgpost', {
    height: '300px',
    width: '522px',
    dompath: false, //Turns on the bar at the bottom
    animate: false, //Animates the opening, closing and moving of Editor windows
    handleSubmit: true
});

myEditor.render();

<% if(editorText != null) {
     out.print("myEditor.setEditorHTML(\""+editorText+"\");");         
       }
%>

</script>

</head>

<body class="yui-skin-sam">

<form name="editor" action="YahooEditor.jsp" method="post">
<textarea name="msgpost" id="msgpost" cols="50" rows="10"></textarea>
<input type="submit" value="submit"/>
</form>
</body>
</html>
  • 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-24T20:42:35+00:00Added an answer on May 24, 2026 at 8:42 pm

    There is a time while the editor is rendering which you cannot access setEditorHTML. Try this:

    var myEditor = new YAHOO.widget.Editor('msgpost', {
        height: '300px',
        width: '522px',
        dompath: false, //Turns on the bar at the bottom
        animate: false, //Animates the opening, closing and moving of Editor windows
        handleSubmit: true
    });
    
    myEditor.render();
    // I just took a guess on which event to use here
    myEditor.on('windowRender', function() {
        myEditor.setEditorHTML("Hello World");
    
    });
    

    Here is a list of YUI Editor events.

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

Sidebar

Related Questions

I came across Side-by-side Assemblies for the first time today while trying to install
I came across the Python with statement for the first time today. I've been
Today is the first time I ever expose to LINQ so to say I
I tried using PHPDoc for the first time today and quickly ran into a
I have been using pil for the first time today. And I wanted to
I've read about binary searches on Wikipedia for the first time today and just
I am using subsonic, I'm reasonably new at it. Today is the first time
Today I see a strange behaviour of Eclipse 3.5.2 for the first time in
http://localhost:3000/genre I'm using Instant Rails, I'm introducing scaffolding for the first time ever. So
Today is the first time I've used Python, so I'm sure this'll be an

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.