Log in

View Full Version : textarea spell checker



I am Abby
05-28-2010, 01:10 PM
Can anyone point me to a good php spell check script out there. I need this for my textarea but it would be nice if I could also use it for other text fields.

I found a couple of them...one worked great on my mac but didn't seem to do anything on my pc, another one seemed very top heavy.

bluewalrus
05-28-2010, 01:34 PM
As the user types or after when being submitted? If when the user types it'll need to be javascript or AJAX.

djr33
05-28-2010, 05:12 PM
Many browsers have spellcheckers. If your users want this, just tell them to use Firefox or another good browser.
I don't see this as an unreasonable request because this isn't saying "my website doesn't work in anything aside from firefox", but that "if you use firefox you can have a spellchecker also!". That seems fine...


There are some libraries for PHP that deal with language things (such as spellchecking), but it will be complex to set this up. Try looking around at php.net for a function library that might be helpful.
Here's one: http://us.php.net/manual/en/book.pspell.php

And yes, this will be very annoying to use if you don't have it work while the user is typing. You can do a "preview" with spell check highlighting the 'incorrect' words, but it won't be anything near a real-time or interactive spellchecker.
Ajax for this would be possible, I guess, but it would require some very complex Javascript on top of many Ajax queries as the user types. Perhaps the spacebar and punctuation trigger spellcheck? But you'd need to only send one word at a time, unless you want to waste the bandwidth (=speed in ajax) sending the extra data.

I am Abby
05-28-2010, 05:22 PM
Using my mac I found what looks like a great one. http://www.broken-notebook.com/spell_checker/

The intentionally misspell dictionary. On my Mac it is underlined with red, if I right click I can choose the correct spelling. When using my PC I don't see a red underline and I can't get the correct spelling by right clicking.

It doesn't seem to work with my PC

djr33
05-28-2010, 05:28 PM
Text box styling is difficult and just not allowed in some browsers. The browser (not the OS) is important to figure this out, but whatever you do won't work everywhere. It should certainly be possible to get this to work in most of the major browsers, though.

The PHP in this is fairly "basic" even if complex. The hard part is the Javascript and that's what isn't cross-browser compatible. If that's the script you want to use, then you may want to repost this in the Javascript section to discuss making it cross-browser compatible. I wouldn't know where to start with that.

I am Abby
05-28-2010, 05:31 PM
Funny thing I just went over to my PC to test the spell check here! Same thing happens if I make a spelling mistake using my mac it's underlined with red and I can correct it by right clicking.

Using my pc to come here...when I make a spelling mistake, nothing! and I don't see any way to fix even if I know the mistake is there.

djr33
05-28-2010, 05:36 PM
Are you referring to the forums? Any textbox will have automatic spellchecking (red dotted underlining) in Firefox and a right click menu lets you select options.
This is completely unrelated to the content of the page. I would assume it does the same thing on a PC, but maybe not-- I haven't tested that.