Client side Validation with FCK Editor
RequiredFieldValidator is not work with FCK editor but CustomValidator will work with FCK editor.
<FCKeditorV2:FCKeditor ID=”txtBody” Width=”660px” Height=”360px” runat=”server” ToolbarSet=”MyToolbar” BasePath=”~/FCKEditor/” />
<asp:CustomValidator runat=”server” ID=”CustomValidator2″ SetFocusOnError=”true” ValidationGroup=”cate” Display=”Dynamic” ErrorMessage=”The Page body is not filled” ClientValidationFunction=”ValidateContentText” Text=”*” />
<script type=”text/javascript”>
function ValidateContentText(source, args) {
var fckBody = FCKeditorAPI.GetInstance(‘<%=txtBody.ClientID %>’);
args.IsValid = fckBody.GetXHTML(true) != “”;
}
</script>











September 14th, 2009 at 7:20 am
Thank you much for this great blog post.