Client side Validation with FCK Editor ,Asp.Net

Posted In Asp.net - By admin On Friday, July 31st, 2009 With 1 Comment

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>

About -

Displaying 1 Comments
Have Your Say

  1. Thank you much for this great blog post.

    [Reply]

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>