When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs

















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Windows Systems Administrator
Jupitermedia
US-CT-Darien

Justtechjobs.com Post A Job | Post A Resume

Published: Monday, April 24, 2000

Adding a Spell Checker to your Web Site


Due to the many questions on the ASP Messageboard on how to perform spell checking on a user's input, this article should prove useful. This article discusses how to use the XDE SpellChecked component, which serves as both a spell checker and a thesaurus. A nifty thing about this component is that it can be used server-side or as a Java applet. Unfortunately, such convenience does not come for free, and the component does cost money, $100 USD as of April 24th, 2000. However, there is a free, 30-day evaluation period, so you can tinker around with the component to see if it fits your needs before plunking down the $100.

- continued -

First things first, download and install the component! Start by visiting http://mirrordns.com/download/, where you will need to enter some information (name, title, email, etc.). Next you are taken to a listing of all the downloadable components from XDE. Choose to download the "Quick Spell Check Full Install." Once you download the install program, install it. You will be presented with a registration menu at the end of the install process - simply select "Evaluation Period," the default option.

Note that this is currently in BETA. If you don't like working with potentially buggy software, I recommend that you do not download this component until its first version is released. I have worked with the component and Java applet a bit and have found some bugs. Just so you know, this is BETA and not ready to be implemented in live systems.

At this point you are ready to register the component. You must decide now if you want to include Word 97's dictionary and thesaurus. This requires that Word 97 or Word 2000 be installed on the Web server! If you want to have this added functionality you will need to follow a special set of instructions, illustrated at http://mirrordns.com/spellchecker/server_installation.htm. If you are happy without using the entire Word 97 dictionary, go ahead and simply register the component like you would any other:

  • Copy the DLL (SpellCheckServer.dll) to your Window's System or System32 directory.
  • Register the component with regsvr32 (i.e.: regsvr32 spellcheckserver.dll)

Now that you have the component installed, you can use the server-side component in your ASP code! To create an instance of the SpellChecker object, simply use the following code:

Set objSpellCheck = Server.CreateObject("SpellCheck.ClsChecker")

As I mentioned earlier, this component provides both spell checking and thesaurus capabilities. First, let's examine how to return a list of synonyms for a given word. To do so, start by using the LookupSynonym method, which expects one parameter, the word to lookup synonyms for. Once this occurs, the SpellChecker object adds a collection of the related words to a collection named SynonymWords. The following snippet of code lists all the synonyms the SpellChecker object knows for the word "Quick."

<%
  Dim objSpellChecker, iLoop
  
  'Create an instance of the SpellChecker
  Set objSpellCheck = Server.CreateObject("SpellCheck.ClsChecker")
  objSpellChecker.UseMSWord = False      'We're not using MSWord
  objSpellChecker.LookupSynonym "Quick"  'Lookup the synonym for "quick"

  'Loop through the returned words:
  Response.Write "The following synonyms for 'Quick' exist:<BR>"
  For iLoop = 1 To objSpellChecker.SynonymWords("Quick").SuggestedWords.Count
    Response.Write objSpellChecker.SynonymWords("Quick").SuggestedWords(iLoop).word
    Response.Write "<BR>"
  Next
%>

A spell check can be performed on the server-side, which is neat, but the true power, in my opinion, lies with the Java applet spell checker. (This article will focus on using this Java applet to spell check. To learn more on how to spell check on the server side, check out: http://mirrordns.com/spellchecker/.)

To use the Java applet, you will need to move the .class files that are installed with the "Quick Spell Check Full Install" to a Web-accessible directory. For this example, I moved it to /spellcheck. Then, to use the applet, you will first need to create a form that will contain the text box or text area whose spelling you wish to check.

<HTML>
<BODY>
  <FORM NAME="frmSpellCheckExample">
    <textarea name="JavaTextArea" rows="8" cols="50"></textarea><P>
    <INPUT TYPE="button" value="Start Spell Check" onclick="SpellCheck();">
  </FORM>

Next, instantiate the Java applet using the APPLET HTML tag:

<applet codebase ="/spellcheck/" code="SpellCheck.class"
        height="1" name="spellcheck" width="1"
        ALT="Applet not displayed">
  <param name="foreground" value="FFFFFF">
  <param name="background" value="008080">
  <param name="label" value="This string was passed from the HTML host.">
</applet>

Note that the codebase parameter in the APPLET tag refers to the directory where the .class files were moved to!

Finally, a bit of client-side JavaScript code is used to populate the applet's parameters:

<script language="JavaScript">
function SpellCheck() {
  document.spellcheck.ptexttocheck =
      document.frmSpellCheckExample.JavaTextArea.value;
  document.spellcheck.doDlg();
  if (document.spellcheck.fixedtext!="") {
    document.frmSpellCheckExample.JavaTextArea.value =
        document.spellcheck.fixedtext;
  }
}
</script>

There you have it! To learn more about this component and Java applet, be sure to check out http://mirrordns.com/spellchecker/.

Happy Programming!


Known Bugs for the SpellChecker Beta at the Time of Writing (4/24/00)
Here is a list of the known bugs for the beta version of the SpellChecker component.

  • The SpellChecker finds "I" to be misspelled
  • CRLF aren't handled well
  • The last word isn't always checked.
  • It's a tad slow
  • Sometimes the applet can't be used twice - haven't been able to recreate it but reloading the page fixes it.
  • Sometimes the button sticks for a moment causing the user to think it has locked up.


Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES