fck编辑器验证 [英] fck editor validation

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

问题描述

如何验证fckeditor.

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

推荐答案

我建​​议您最好的信息来源是作者( CKSource .com [ ^ ]),因为他们会比对此了解更多(可能)任何人.
I suggest your best source of information is the authors (CKSource.com[^]) as they will know more about it than (probably) anyone here.


在您的aspx页面上使用此Javascript.


Use this Javascript at your aspx page.


<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编辑器验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆