本文介绍了fck编辑器验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证fckeditor.

how to validate a fckeditor. it should not be empty.

推荐答案


<script type="text/javascript" language="javascript">
function ValidateForm()
{
     var valid=true;
     var EditorInstance = FCKeditorAPI.GetInstance('FCKeditor1');    //location_info is name of text area.
     var contents = EditorInstance.GetXHTML(true);
        if(!contents)
        {
            alert("Please enter some value !!");
            EditorInstance.Focus();
            var valid=false;
        }
        return valid;
}
</script>





//此处"FCKeditor1"是fckeditor的ID.

另外,将此代码放在button标记中,单击该标记即可验证fckeditor.

OnClientClick ="return ValidateForm();"

例如

< asp:Button ID ="btnSave" OnClientClick ="return ValidateForm();" runat ="server" Text =保存数据" onclick ="btnSave_Click"/>


这肯定会解决您的问题.

阿努拉格
@cheers @





// Here ''FCKeditor1'' is the Id of your fckeditor.

Also, Put this code in the button tag, on the click of which you want to validate your fckeditor.

OnClientClick="return ValidateForm();"

Eg.

<asp:Button ID="btnSave" OnClientClick="return ValidateForm();" runat="server" Text="Save Data" onclick="btnSave_Click" />


This will surely solve your problem.

Anurag
@cheers@


这篇关于fck编辑器验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:05