Question

I am trying to integrate yui editor in a cakephp form the editor is attached to the textarea, I tried the handleSubmit option and it didn't work, so I went trying manual. so- I've attached a listener to the onsubmit, which is working.. or not.

Editor initialization ( a copy-paste from yui site, only element named changed):

(function() {
    //Setup some private variables
    var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event;  
        //The SimpleEditor config
        var myConfig = {
            height: '300px',
            width: '99%',
            focusAtStart: true
        };

    //Now let's load the SimpleEditor..
    var myEditor = new YAHOO.widget.SimpleEditor('ArticleContent', myConfig);
    myEditor.render();
})();

Initialization works fine (I assume) since the editor now holds the real content of that record field.

The onsubmit listener function:

function setTextArea()
{
alert('s');  
var dd = myEditor.saveHTML();  
alert('d');
return false;
}

The first alert is working, so the event is handled. However, the second alert never happens. the form - somehow - is submitted before it. and, the content is not saved.

further checks shows that ANY call to myEditor [even alert(myEditor)] is submitting the form...

anyone? help? i

Was it helpful?

Solution 2

The best solution was to use tinyMCE....

OTHER TIPS

just a guess, but is any code in the 'saveHTML' function calling something that clashes with cakephp functions?

if this is the problem, you may be able to get around it by modifying the yui code function names (hacky i know, but unless there is some way to use a custom namespace for it i think you'd be stuck with it)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top