Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to validate a fckeditor. it should not be empty.
Posted

I suggest your best source of information is the authors (CKSource.com[^]) as they will know more about it than (probably) anyone here.
 
Share this answer
 
Use this Javascript at your aspx page.


XML
<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>




// 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@
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900