Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';t读取'的属性;getHTML';未定义的Liferay CK编辑器内容的_Javascript_Jquery_Liferay_Liferay 6_Liferay Aui - Fatal编程技术网

Javascript Can';t读取'的属性;getHTML';未定义的Liferay CK编辑器内容的

Javascript Can';t读取'的属性;getHTML';未定义的Liferay CK编辑器内容的,javascript,jquery,liferay,liferay-6,liferay-aui,Javascript,Jquery,Liferay,Liferay 6,Liferay Aui,我在表单中使用C.K编辑器,当我试图在CK编辑器中获取内容时,我得到了未定义的“getHTML”的无法读取属性。以下是我的代码: 这是我的html: <aui:layout> <aui:column columnWidth="100"> <liferay-ui:input-editor width="100%" name='<%= renderResponse.getNamespace()+"healthcont

我在表单中使用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);
    }
});
$jquery(“.save record”)。单击(函数(){
试一试{
警报(“单击保存记录”);
var标志=真;
var title=$jquery(“#title”).val();
警报(“标题为”+标题);
if(title==null | | title.trim()==“”){
$jquery(“#titleErrorDiv”).show();
flag=false;
}否则{
$jquery(“#titleErrorDiv”).hide();
}
var health_content=window.healthcontent.getHTML();
警报(“健康内容为”+健康内容);
if(health\u content!=null&&health\u content.trim()!=“”){
$jquery(“#content”).val(健康内容);
$jquery(“#healthcontentErrorDiv”).hide();
}否则{
$jquery(“#healthcontentErrorDiv”).show();
flag=false;
}
//提交表格
国际单项体育联合会(旗){
$jquery(“#HealthReportsAdministration”).submit();
}
}捕获(e){
警报(“健康记录中引发的异常11”+e);
}
});

window.healthcontent.getHTML();这是罪魁祸首。 窗口对象中不存在此类对象。也许你应该做的是,在下面这行的地方

<liferay-ui:input-editor width="100%" name='<%= renderResponse.getNamespace()+"healthcontent" %>' height="550"  />

使用


然后使用

var health_content = $('#'+<portlet:namespace/>healthcontent);
var health_content=$('#'+healthcontent);
现在对此变量执行任何操作。

我已修改为


我还修改了输入cssClass,因此我将其更改为cssClass

,您可以使用edditor自动生成的ID。也可以使用编辑器的名称进行选择
var health_content = $('#'+<portlet:namespace/>healthcontent);