2012-04-12 7 views
1

イムイムこのJavaScriptコードこのオンその内容を渡すためにYUIのエディタを取得する方法

var myEditor = new YAHOO.widget.Editor('Body', { 
    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(); 

``

を使用して、ASP MVCサイト上YUIリッチテキストエディタを使用しようとしていますテキストエリア

<div class="yui-skin-sam"> 
      @Html.TextAreaFor(model => model.Body, new { cols = "50", rows = 10 }) 
      @Html.ValidationMessageFor(model => model.Body) 
     </div> 

エディタはロードされますが、フォームを送信するとその内容は渡されません。その中に何もなかったら私がするべきことが必要だと言っている蓋のメッセージ。

どのように私は私が望むようにこれを得ることができるか知っていますか?

+0

また、私はテキストソースの名前とIDを実際に見ています – Roge

答えて

0

他の誰かがこの問題を解決した場合の解決策は次のとおりです。

あなたはhandleSubmitを設定してみること

:真この

var myEditor = new YAHOO.widget.Editor('Body', { 
height: '300px', 
width: '522px', 
dompath: true, //Turns on the bar at the bottom 
animate: true, //Animates the opening, closing and moving of Editor windows 
handleSubmit: true 
よう

}); myEditor.render();

エディタは自動的にアタッチを試み、myEditor.saveHTML()を自動的に呼び出して、内容をテキストエリアに戻します。それが私のためにしたのと同じように失敗した場合は、以下のようなイベントを設定して手作業で行います。

YAHOO.util.Event.on('somebutton', 'click', function() { 

myEditor.saveHTML(); 
alert("test"); 
}); 

ここで、somebuttonはフォームの送信ボタンの名前です。

これを実行すると、モデルにhtmlタグが見つかると、asp.netはエラーになります。それは別の問題ですので、私はここで解決策を説明しません。

関連する問題