Sunday, May 17, 2009

how to validate an fckeditor using javascript

i have had some problems finding out how to validate the fckeditor. i just found out. in between the script tags for javascript, declare a variable for the edior: var editorValue = FCKeditorAPI.GetInstance('name_of_editor') ;

you can check if its empty by using this: if(editorValue.EditorDocument.body.innerHTML == "<p> <br> </p>"){
msg += " \n";
}

you use the "


" because by default, it places any value of the editor between the p and br tags.

im sure im saving some people the time it took me to figure it out.

7 comments:

thirumalai said...

Hi jerome,

This information is very very usful for me.

Thanks lot

Jerome Bailey said...

you are welcome thirumalai

Anonymous said...

Thanks...this came in real handy...-Kevin

Anonymous said...

Hi Jerome,
Thx for ur information. It really helps me lot. - Senthil

Unknown said...

Thanx for sharing this with us..

sasa said...

if i use FCKeditor in any other webpage. how can i called?.....
Pls help me..
By Sathis

sasa said...

if i use FCKeditor in any other webpage. how can i called?.....
Pls help me..
By Sathis