Word complete in JavaScript

I've recently found Word Complete web application. It's a cool little JavaScript program that offers word completion to the text user enters in a text area (just like IntelliSense, only in relationship to English. As letters are entered script automatically suggests a complete word).Word suggestion is not new in JavaScript and Google has been offering it (in beta) for some time. Actually that's one of the things that sparkled a lot of renewed interest in XMLHttp. This application seems to be simple, but pretty neat at the same time.

It is an important step towards on the fly spell-checking support (similar to how Microsoft Word marks misspelled words as you type). In fact, I think adding support for marking misspelled words is just a short step from Word Complete. Instead of suggesting a new word the script can try to look up the word in a dictionary, and if none is found underline it (or highlight it some other way). This leads to a problem of misspelled word indication.

The simplest solution would be to wrap the word in a span with CSS class name set to some class. A stylesheet could set background image to a wiggly red line at the bottom of the line for this class and so the word would get underlined. This would result in direct modification of the text entered by the user, and if the user would try to select and copy the text out the misspelled span tags would remain in the copied text (I think there's a way to format the text when it is copied or pasted, so this problem is probably solvable). An alternative solution could have a list of misspelled words next to the text area, or something similar. It would allow user to go to the selected word on click or directly fix it.

Another problem related to inline auto spell checking is showing a list of suggestions on the right click. Displaying a context menu or downloading a list of words from the server can be simple tasks on their own, but putting it all together and ensuring it's easy to reuse the code in web application development can be hard. I might some day have enough time to play around and try to come up with my own inline spell checker, but it would require setting up a spell checking web service, learning XMLHttp with which I'm not very familiar, etc.



Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Slava
Posted on: 9/26/2005 at 11:44 AM
Categories: Web development
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Friday, November 21, 2008 7:13 AM