I am using C.K editor in my form, When I try to get the content in the CK editor I am getting Can't read property of 'getHTML' of undefined. the following is my code : This is my 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>
And below is my jquery code:
$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);
}
});