View Full Version : Spell Check dialog with server-based CGI

1 Jul 2010, 4:32 AM

I have a need for a spell-check functionality in my application. The reasoning is as follows:

Not all users have a browser with a built-in spell-check feature.
Having my own spell-check allows me to control what's in the dictionary, e.g. add myProduct, and add any custom functionality I desire, e.g. syntax checking.

After searching in vain for an existing ExtJS code that will do this, I have finally written some code that will do this.
At this point, it is rather crude, and not a plugin as it probably should be. It was enough work already so I stopped at this :)
Nevertheless, I would like to release it at this point so you can make use of it and help me improve it.
This code uses server-side Perl CGI script that checks the submitted text with ispell, and returns a JSON with a hash of spelling errors and a list of fix suggestions for each error.

How to use this:

Include spell_check.js and spell_check.css
Put spell_check.cgi in your Perl CGI directory.
If you want to use a button to invoke the spell-checking: call the get_spell_button(target) function, were target is the field from which the text to be checked is taken.
Invoking without button: call function spell_check()

Currently I don't have an accessible working demo that I can guarantee will be accessible for a long time.
If anyone can suggest a good place to put this demo, please do.

Attached you'll find a ZIP file with the JS file, CSS file, Perl CGI file, and button icon.

Known issues:

Layout problem: empty area at bottom of dialog window

Future improvements:

Allow user to add words

I didn't implement this because it involves issues of permissions: I don't want my external users (customers) to have permissions to add words to the dictionary, but I think it would be nice to allow them to suggest words to be added. Since doing this involves authentication, I will probably do this separately with my own authentication mechanism.

Allow direct access to any marked word in the checked text by clicking on it.