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@