获取 Umbraco 后台富文本编辑器的值
Get the value of Rich Text Editor in Umbraco backoffice
我定义了一个名为 Reply
的 属性,文档类型为 RichTextEditor
。
我无法获取 Reply
的值。此问题仅适用于类型为 RichTextEditor
!!!
的属性
如何在 Umbraco 后台获取富文本编辑器的值?
我用过 Umbraco 7.x
和 ASP.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:
}
);
}
});
要获取 Reply
的值,您可以使用此代码。
var replyList = $("[id*='Reply']");
for (i = 0; i < replyList.length; ++i) {
var rText = replyList[i].value;
if (!(rText === "" || rText === null)) {
replyText = rText;
}
}
我定义了一个名为 Reply
的 属性,文档类型为 RichTextEditor
。
我无法获取 Reply
的值。此问题仅适用于类型为 RichTextEditor
!!!
如何在 Umbraco 后台获取富文本编辑器的值?
我用过 Umbraco 7.x
和 ASP.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:
}
);
}
});
要获取 Reply
的值,您可以使用此代码。
var replyList = $("[id*='Reply']");
for (i = 0; i < replyList.length; ++i) {
var rText = replyList[i].value;
if (!(rText === "" || rText === null)) {
replyText = rText;
}
}