65.9K
CodeProject is changing. Read more.
Home

RequireField Check for FCKEditor

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

Oct 11, 2013

CPOL
viewsIcon

6340

We all may encounter a problem of validating RequiredField for FCKEditor. Here is the Solution: Your HTML Markup for

We all may encounter a problem of validating RequiredField for FCKEditor. Here is the Solution:

 

Your HTML Markup for FCKEditor:

<FCKeditorV2:FCKeditor ID="HTMLFCKeditor" runat="server" Height="400px" Width="100%">
</FCKeditorV2:FCKeditor>
<asp:CustomValidator ID="CustomValidator2" runat="server" ValidationGroup="Invitation"
ErrorMessage="Enter Message !" Display="Dynamic" ClientValidationFunction="ValidateFCKEditor"></asp:CustomValidator>

CustomValidator Javascript Function:

function ValidateFCKEditor(source, args)
{
    var fckEditorClientID = document.getElementById('<%=HTMLFCKeditor.ClientID%>');              
    args.IsValid = FCKeditorAPI.GetInstance(fckEditorClientID.id).GetXHTML(true) != "";      
}

 

Just use above code to apply RequiredField Validation for FCKEditor.