2009-08-18 14 views
1

FCKeditorのテキストボックス(FCKeditorのJavascript ReplaceTextArea()関数を使用して作成)を含む単純なASP.Net MVCビューがあります。これらは、Ajax.BeginFormヘルパーの中に含まれています。これをhanldingFCKeditor、AJAX、およびASP.NET MVCを使用したバインドアクションパラメータの問題

<% using (Ajax.BeginForm("AddText", "Letters", 
     new AjaxOptions() { UpdateTargetId = "addTextResult" })) 
{%> 
    <div> 
     <input type="submit" value="Save" /> 
    </div>  

    <div>  
    <%=Html.TextArea("testBox", "Content", new { @name = "testBox" })%> 

    <script type=""text/javascript""> 
    window.onload = function() 
    { 
     var oFCKeditor = new FCKeditor('testBox') ; 
     var sBasePath = '<%= Url.Content("~/Content/FCKeditor/") %>'; 
     oFCKeditor.BasePath = sBasePath; 
     oFCKeditor.ToolbarSet = "Basic"; 
     oFCKeditor.Height = 400;  
     oFCKeditor.ReplaceTextarea() ; 
    } 
    </script> 

    <div id="addTextResult"> 

    </div> 
<%} %> 

コントローラのアクションは以下のとおりです。AddTextアクションでtestBox文字列は常に「コンテンツ」である

Ajaxのフォームの最初の提出時に
[ValidateInput(false)] 
public ActionResult AddText(string testBox) 
{     
    return Content(testBox); 
} 

FCKeditorの内容が何に変更されたかに関係なく、もう一度Ajaxフォームが再度送信されると(それ以上の変更は必要ありません)、testBoxパラメータにFCKeditorの実際の内容が正しく含まれます。

FCKeditorで置き換えずにHtml.TextAreaを使用すると正常に動作し、AJAXの標準の投稿フォーム送信場所を使用すると、すべて正常に動作します。

何か間違っていますか?

この問題には、適切な/直感的な回避策がありませんか?

答えて

1

問題はMVCとは無関係ですが、AJAXと組み合わせてFCKeditorを使用することによって発生します。詳しくsee hereについて

<input type="submit" value="Save" onclick="FCKeditorAPI.GetInstance('TestBox').UpdateLinkedField();" /> 

:私は送信ボタンのOnClickイベントに次を追加し、上記のコードで修正します。

関連する問題