2016-10-04 53 views
0

我已經定義了一個屬性,名爲Reply,文檔類型爲RichTextEditor。我不能得到Reply的價值。此問題僅適用於其類型爲RichTextEditor的屬性!獲取Umbraco後臺中的富文本編輯器的值

如何在Umbraco後臺中獲得富文本編輯器的價值?我使用了Umbraco 7.xASP.NET MVC

angular.module("umbraco").controller("Reply.controller", function ($scope, $http, $routeParams) { 
    $scope.SendReply = function() { 
     var contentId = $routeParams.id; 
     var replyText = $("#Reply").val(); // without value ??? (type of Reply is RichTextEditor) 
     var email = $("#Email").val();  // It's OK. 
     var dataObj = { 
      ReplyText: replyText, 
      ContentId: contentId, 
      Email: email, 
     }; 
     $http.post("backoffice/Reply/ReplyToIncomingCall/ReplyMessage", dataObj).then 
     (
      function (response) { 
       alert("YES!"); 
       //TODO: 
      } 
     ); 
    } 
}); 

回答

0

要獲得值Reply,您可以使用此代碼。

var replyList = $("[id*='Reply']"); 

     for (i = 0; i < replyList.length; ++i) { 
      var rText = replyList[i].value; 
      if (!(rText === "" || rText === null)) { 
       replyText = rText; 
      } 
     }