2016-10-04 51 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; 
      } 
     }