Embedding SpellChecker Support
Revision 09-13-2004

To add SpellChecker support to your website, please follow four steps:

  1. Register and receive a Customer ID
  2. Download the customized JavaScript file
  3. Download the SPROXY script
  4. Modify your web pages

Register and receive a customerID

To register, please go to the Sign Up page and fill out our short form. We will send you an e-mail containing your customerID. Please save this ID, as it will be required for the rest of the installation.
Top of page

Download the Customized JavaScript File

To download JavaScript file please login to "My Account" Section of the SpellChecker.net site using customerid and password sent to you in the registration email. Click on the "Download JavaScript file" link. In the page opened click "Download" button to download the spch.js JavaScript file (please select "save to Disk" if prompted). 
The JavaScript file contains information that is specific to each customer's web site, so it should not be used on or obtained from another site. Create a directory named sproxy in the root directory of your site. Copy spch.js file to the sproxy directory on your web site.
Top of page

Download the SPROXY Script

The SPROXY script returns corrected data from the SpellChecker engine to the text-box on your web page.

1.  Download the SPROXY script. Please login to "My Account" Section of the SpellChecker.net site using customerid and password sent to you in the registration email. Click on the "Download SPROXY script" link. To meet requirements of customers SPROXY script is prepared for various platforms. You can download any suitable for your environment version.

Each version (archive file SPROXY_*.zip) contains the following files:

  • sproxy script - main script. Depend on platform which the script intended for it has corresponded extension - sproxy.pl for Perl version, sproxy.asp for .ASP version, sproxy.cgi for bianry version, etc.
  • sproxy.ini - settings file - contains some settings which are used to customize sproxy script behavior. Syntax of sproxy.ini depends on platform, but sproxy.ini for all platforms has same settings;
  • *.tmpl (check.tmpl, dospell.tmpl, init.tmpl, opts.tmpl, result.tmpl, show.tmpl, etc.) - the template files.

2. Create a directory named sproxy in the root directory of your site. Copy all files from sproxy_*.zip archive to the sproxy directory on your web site. If, by some reason you can't create directory with the specified name then copy files from archive to other suitable directory (/cgi-bin, /scripts or any other directory where script execution is enabled) .

Perl version
If you downloaded Perl version of sproxy, open the file in edit mode and change its first line according to your Perl interpreter location.  This file is created to run on UNIX systems and the first line will be #!/usr/bin/perl. Windows users should alter this line to reflect the Perl location, for example #!c:/perl/bin/perl.exe (note the forward slashes).

.Net version There are several additional files and directories:

  • web.config
  • global.asax
  • bin/sproxy.dll
These files are required by .Net web application. Settings stored in the configuration file sproxy.ini for other versions of sproxy script are moved to the file web.config. To make sproxy script .Net version working, create a Virtual Application for the directory sproxy (via IIS MMC Console).

3.  You need to update sproxy.ini file to reflect the real location of sproxy script. The sproxy.ini (Web.config ) file contains some variable parameters, which must be customized. Find and change the following parameter in this file:

 SPROXY_URL should be updated with the full URL to the sproxy script file (There is no such setting in Web.config since it handles it automatically). Set the value to the full URL to the sproxy script http://<web_site_name>/<path_to sproxy>/sproxy.<SPROXY_EXT>. Below are some examples of URLs:

  • Perl version: http://myserver.com/sproxy/sproxy.pl.
  • .ASP version: http://myserver.com/sproxy/sproxy.asp.
  • Binary CGI script, in cgi-bin directory: http://myserver.com/cgi-bin/sproxy.cgi.

Modify HTML Pages

Use these instructions to add our SpellChecker.net system to virtually any text box on an HTML page. Supply your users with a powerful and advantageous support function by completing the following steps:

STEP 1
Add this line of JavaScript code into the HEAD tag (<HEAD> </HEAD>) of your web page:
<script type="text/javascript" language="javascript" src="http://myserver.com/sproxy/spch.js"></script>
myserver.com should be replaced with the actual name of your web site.

Please note that if you have not put spch.js file into sproxy directory then you should specify actual directory path where you have put this file.

This line of code includes a JS library that enables the doSpell function.

Top of page

STEP 2
This step includes the code to call the doSpell function, opening the SpellCheck window and initializing a new SpellCheck session.

Add either of these JavaScript codes within the FORM tags (<FORM> </FORM >) in the BODY section of your web page, according to the appearance you desire:

To add SpellCheck with an input button, use the following code:


<INPUT TYPE = "BUTTON" VALUE = "Spell Check" onclick="var f=document.forms[0]; doSpell( 'LANGUAGE', f.INPUTCONTROLNAME, document.location.protocol + '//' + document.location.host + '/sproxy/sproxy.SPROXY_EXT', true);">
OR

To add SpellCheck with a link, use the following code:

<a href="javascript: var f= document.forms[0];doSpell('LANGUAGE', f.INPUTCONTROLNAME, document.location.protocol + '//' + document.location.host + '/sproxy/sproxy.SPROXY_EXT', true); ">SPELLCHECK</a>

Top of page



Where do I add this line of code?
Each page can be represented by the following example (the simple HTML page):
<html>
<head>
...
</head>
<body>
...
<FORM>
...
<TEXTAREA NAME="Message" ... >...</TEXTAREA>
...
</FORM>
...
</body>
</html>

Here is an example of that simple HTML page:

Figure 1.


Instead of the TEXTAREA control, any other can be used. For example, <input type=text name=...>)
Once you have embedded the code, the page will have the following structure:
<html>
<head>
...
<script language= "javascript" src="http://myserver.com/sproxy/spch.js"></script>
</head>
<body>
...
<FORM>
...
<TEXTAREA NAME="Message" ... >...</TEXTAREA>
<INPUT TYPE="BUTTON" VALUE= "SpellCheck" onclick= "var f= document.forms[0]; doSpell('LANGUAGE', f.Message, document.location.protocol + '//' + document.location.host + '/sproxy/sproxy.SPROXY_EXT', true);">
...
</FORM>
...
</body>
</html>

Here is an example of that simple HTML page with embedded SpellChecker support:

Figure 2


SpellChecker allows you to define the final destination of this control by inserting lines according to personal preference. Examples would include placing it AFTER each input control (as shown in PICTURE 2) or in FRONT.
Top of page



STEP 3

There are values within the above codes that you must change.

LANGUAGE
defines the language which will be used by SpellCheck engine. Change the parameter to one of the following values:
"en" - American English
"uk" - British English
"fr" - French
"ge" - German
"it" - Italian
"sp" - Spanish
"dk" - Danish
"br" - Brazilian Portuguese
"nl" - Dutch
"no" - Norwegian
"pt" - Portuguese
"se" - Swedish
INPUTCONTROLNAME
determines which text input needs to be SpellChecked and updated. This parameter should be substituted with the name of the input control in which text needs to be checked. It is important to remember that these input controls must contain a name attribute (for example, name="Message" or name="Body", where the right side is the value). If the name attribute is not defined, you must add it manually.
SPROXY_EXT
extension of sproxy script - pl for Perl version, asp for ASP version, cgi for binary CGI script, etc. To find out what extension to use check the sproxy archive you have downloaded from SpellChecker.net site.

The following are examples of the completed string:

<INPUT TYPE= "BUTTON" VALUE= "Spell Check" onclick= "var f=document.forms[0]; doSpell ('en', f.Message, document.location.protocol + '//' + document.location.host + '/sproxy/sproxy.pl', true);">
OR
<a href="javascript: var f=document.forms[0]; doSpell('br', f.Text, document.location.protocol + '//' + document.location.host + '/sproxy/sproxy.pl', true); ">SPELLCHECK</a>

Top of page


SpellChecker.net, PO Box 641697, Los Angeles, CA 90064 USA, Tel +1(310) 287-2001 x801, Fax +1(310) 287-2347
© 1999-2007 SpellChecker.net, Inc. All Rights Reserved.