During a recent project, a client wanted to get a spellchecker working with FCKEditor. They had selected Foundeo Spell Checker to work with, which is a nicely-portable implementation since it uses a .jar library as the spelling dictionary-- no need to install a specific library that could only run on Windows or OSX or Linux.
The following instructions are good for the downloaded version of FCKEditor, not for the version that's built in to Coldfusion 8. Because the JavaScript object reference for the editor is different for CF8, I'll have to give instructions for that editor in another post.
Given that you have both FCKEditor and Foundeo Spell Checker correctly installed on your site, the steps to set up the spell checker are as follows:
- Create a hidden form field in the same form as you have FCKEditor. For the purposes of this tutorial, we'll call this one "spellcheckText". We'll need it to copy the text out of the editor since the spellchecker can't read the contents of the editor directly.
- Add the following script to your page:
function spellcheckerBegin() { // Get the text from the FCKEditor document.compose.spellcheckText.value = FCKeditorAPI.GetInstance('message').GetHTML(); // Run the spell-checker on the text spell('document.compose.spellcheckText.value'); } function spellcheckerFinish() { // Put the spell-checked text back into the FCKEditor FCKeditorAPI.GetInstance(document.compose.message.id).SetHTML(document.compose.spellcheckText.value); return false; } - Create a link on the editor's web page that calls
spellcheckerBegin():<a href="#" onclick="spellcheckerBegin(); return false;">Check spelling</a>
- Finally, add a line to the ColdFusion source for the spell checker. At the end of the
done()function of/spellchecker/spell.cfm(around line 234), put a call to ourspellcheckerFinish()function so that the spell-checked text gets back into the editor:if(parent.opener.spellcheckerFinish) parent.opener.spellcheckerFinish();
That's it! If you follow those steps, you should have Foundeo Spell Checker working with the installed version of FCKEditor. Let me know if you find any problems.

Comments (3)
April 29, 2008
06:50AM | #
Hi,
I want to combine this spell check functionality with the submit button of a form which is already redirecting to new page for further processing.
Meaning, I want that if I click the submit button it first runs the spell checker and then does the rest of the processing.
is this possible?
April 29, 2008
21:46PM | #
@Kanika, yes, it is possible to call the spellchecker as a part of a form submission. You'll need to do two things: first, embed the call to the spellchecker in your submit button with the following attribute:
onclick="spellcheckerBegin(); return false;"(it's important to return false, or else the form submission will occur before the spelling check has a chance to run). Second, put a command to submit the form as the last line in thespellcheckerFinish()function so that the form submisson does happen:document.formName.submit();. Make sure to change "formName" in that line to the actual name of your form.June 25, 2008
18:34PM | #
I have used this for spell checker
thanks
www.elovemagic.com