Solved

textarea not being posted as form data - yui rich text editor

Posted on 2009-07-14
2
556 Views
Last Modified: 2013-11-19
Hi all,

I am trying to design a customized version of Rich text editor using YUI library. I've done everything that is mentioned in the documentation, but the data from underlying textarea is not being submitted as POST data to the action script. As soon as I remove the YUI RTE code, the data gets submitted properly. The code is attached. I could see that the POST data does not contain entry for "full_description" if I enable the rich text editor part, but I could see the same when I disable it.

I have wasted many hours now .. and still not able to figure out what is wrong here. Can anybody help me finding out the issue?

TIA,
--Venkat.
<form action="action.php" method="POST"  id="form2"  name="form2"  onsubmit="return check_data();" enctype="multipart/form-data">
<textarea name="full_description" id="full_description" cols="50" rows="10"></textarea>
.
.
.
<script type="text/javascript">
 var myEditor = new YAHOO.widget.Editor('full_description', 
                                       { height: '500px', width: '722px', .... });
myEditor.render();
 
YAHOO.util.Event.on('update_desc_button', 'click', function() {
      //Put the HTML back into the text area
       myEditor.saveHTML();
});
</script>
 
<input type="submit" name="update_desc_button" id="update_desc_button" value="Update"/>
</form>

Open in new window

0
Comment
Question by:venkat_pedapati
2 Comments
 
LVL 5

Expert Comment

by:Koma666
ID: 24869419
Did you follow the example on: http://developer.yahoo.com/yui/examples/editor/post_editor.html
you need some callback funtions to get this done.

And I think you need to set the functions for the save button:

You need to change this code from the tutorial to fit your needs:

var _button = new YAHOO.widget.Button('submitEditor');

    _button.on('click', function(ev) {
        YAHOO.log('Button clicked, initiate transaction', 'info', 'example');
        Event.stopEvent(ev);
        myEditor.saveHTML();
        window.setTimeout(function() {
            var sUrl = "assets/post.php";
            var data = 'filter=' + ((Dom.get('filter').checked) ? 'yes' : 'no') + '&editor_data=' + encodeURIComponent(myEditor.get('textarea').value);
            var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, data);
        }, 200);
    });
0
 

Accepted Solution

by:
venkat_pedapati earned 0 total points
ID: 25232589
I could not get this to work. I have switched to tinymce for now. Will reopen this question when I switch back later ..
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question