可以't读取'getHTML'未定义的Liferay CK Editor内容
Can't read property of 'getHTML' of undefined Liferay CK Editor content
我在表单中使用的是C.K编辑器,当我试图在CK编辑器中获取内容时,我会得到无法读取未定义的'getHTML'属性。以下是我的代码:这是我的html:
<aui:layout>
<aui:column columnWidth="100">
<liferay-ui:input-editor width="100%" name='<%= renderResponse.getNamespace()+"healthcontent" %>' height="550" />
<aui:input id="content" name="content" type="hidden" value='' />
<div style="display: none;" id="<portlet:namespace/>healthcontentErrorDiv">
<div class="portlet-msg-error">
Health Report content is required
</div>
</div>
</aui:column>
</aui:layout>
下面是我的jquery代码:
$jquery(".save-record").click(function(){
try{
alert('save record clicked');
var flag = true;
var title = $jquery("#<portlet:namespace/>title").val();
alert("title is "+title);
if(title == null || title.trim() == ""){
$jquery("#<portlet:namespace/>titleErrorDiv").show();
flag = false;
}else{
$jquery("#<portlet:namespace/>titleErrorDiv").hide();
}
var health_content = window.<portlet:namespace/>healthcontent.getHTML();
alert("health_content is "+health_content);
if(health_content != null && health_content.trim() != ""){
$jquery("#<portlet:namespace/>content").val(health_content);
$jquery("#<portlet:namespace/>healthcontentErrorDiv").hide();
}else{
$jquery("#<portlet:namespace/>healthcontentErrorDiv").show();
flag = false;
}
// Submitting the form
if(flag){
$jquery("#<portlet:namespace/>HealthReportsAdministration").submit();
}
}catch (e) {
alert("Exception raised in HEALTH records11 "+e);
}
});
window.healthcontent.getHTML();是罪魁祸首。窗口对象中不存在这样的对象。也许你应该做的是,在的后面
<liferay-ui:input-editor width="100%" name='<%= renderResponse.getNamespace()+"healthcontent" %>' height="550" />
使用
<liferay-ui:input-editor width="100%" name='<%= renderResponse.getNamespace()+"healthcontent" %>' id="<%= renderResponse.getNamespace()+"healthcontent" %>" height="550" />
然后使用
var health_content = $('#'+<portlet:namespace/>healthcontent);
现在,对这个变量执行任意操作。
我已修改为
<liferay-ui:input-editor width="100%" name="healthcontent" height="550"/>
我还修改了inputCssClass,所以我将其更改为cssClass。
相关文章:
- 如何在corona sdk中从CK编辑器中检索数据
- Liferay:从portlet调用JSON服务
- 是否存在Javascript Liferay Service库的文档?如何处理错误情况
- 使用主题运行时portlet liferay时出现Javascript错误
- 可以't读取'getHTML'未定义的Liferay CK Editor内容
- CSS conflict Liferay
- 通过CK编辑器获取值和存储数据
- 如何在Liferay serveResource(-,-)方法中从AJAX请求下载文件
- Liferay网络表单组件字段验证
- 在liferay中使用ajax
- 手动创建Liferay登录url
- "未定义“角度”;在Liferay中存储的角度应用程序上执行Protractor测试时出错
- Liferay主题脚本错误:未捕获语法错误:意外的标记ILLEGAL
- 通过Alloy UI(Liferay 6.2)在切换器中加载视频
- 获取另一个文本字段(Liferay aui)的文本字段的值
- 如何在Liferay搜索组件中获取搜索按钮的ID
- Joomla 1.5 / CK表单:需要帮助调试JavaScript工具提示上的字体大小
- “Liferay.Language.get”javascript调用返回键而不是值
- LifeRay门户画布调整大小
- 使用 JavaScript 实现 Brainf*ck 循环