Embedding SpellChefcker Support
Revision 7-30-2002

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.CGI script file
  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.

Top of page



Download the SPROXY.CGI Script File

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

1.  Download the file "sproxy.cgi". Please login to "My Account" Section of the SpellChecker.net site using customerid and password sent to you in the registration email. Please open "Download SPROXY.CGI script" page for currently supported versions of the file. Click on the "Download SPROXY script" link.

Each of the archive files SPROXY_*.zip contains the following files:

  • sproxy.cgi - main script;
  • sproxy.ini - ini-file;
  • *.tmpl (check.tmpl, dospell.tmpl, init.tmpl, opts.tmpl, result.tmpl, show.tmpl, unload.tmpl) - the template files.

2. Copy all files from sproxy_*.zip archive to the directory on your web site that has permissions for script execution (for example /cgi-bin or /scripts).

Perl script
If you downloaded Perl version of sproxy.cgi, 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).


3. The sproxy.ini file contains some variable parameters, which must be customized. Find and change the following parameters in this file:

a. SPCH_JS_PATH should be replaced with the full URL where you placed the file spch.js. If you do not have spch.js file please go to the http://emedtools.spellchecker.net/support/getscript.html to download it.

b. SPROXY_URL should be replaced with the full URL of the sproxy.cgi file. For example, http://my_server.com/cgi-bin/sproxy.cgi.

c. DEF_LANG should be replaced with the default language to be used by SpellCheck. Change this 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

d. DEF_ENABLED should be replaced with 'true' or 'false'. This variable defines the default state of Auto SpellCheck. Set it to 'true' if you want it to be enabled by default.

e. DEF_TIMEOUT should be replaced with the desired timeout value (in seconds) for background processing.

f. OPT_BG_CL should be replaced with the desired color value of the Settings Dialog background. Please use the standard HTML codes for the colors.

g. AUTO_HIDE can be [af] flag or nothing.  [af] stands for auto-finish. This flag turns on/off the ability to automatically dispatch the checked text to the text-box in your page.  For example:

For Perl version
...
$auto_hide = "\"[af]\"";
...

or
...
$auto_hide = "\"\"";
...

For Win32 version
...
auto_hide = [af]
...

or
...
auto_hide =
...

For chat systems several other flags could also be used:
[dc] - don't close SpellCheck window. It saves the time on opening SpellCheck window. SpellCheck window will be a background window.
[sw] - small window. It has the sense because entered text in chat applications is usually short.
[cp] - close prompt. This flag turns on/off two links ("Abort SpellChecker" and "Send Without Checking") on the SpellCheck window during its initial loading. Press on "Abort SpellChecker" link closes SpellCheck window and returns to text-box. Press "Send Without Checking" link dispatches the text without checking and SpellCheck window is not closed.

For example: [dc][sw][cp][af] or [dc][af] or [af][dc][sw] or leave empty.

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:
Top of page

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://your_url/spch.js></script>
your_url should be replaced with the actual url of the folder on your server where you uploaded the spch.js 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 + '/CGIBIN/sproxy.cgi', 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 + '/CGIBIN/sproxy.cgi', 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://your_url/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 + '/CGIBIN/sproxy.cgi, 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.
CGIBIN
is the name of your virtual directory that will contain the file sproxy.cgi. Simply replace this string with your virtual directory name.

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 + '/cgi-bin/sproxy.cgi', true);">
OR
<a href="javascript: var f=document.forms[0]; doSpell('br', f.Text, document.location.protocol + '//' + document.location.host + '/cgi/sproxy.cgi', true); ">SPELLCHECK</a>

Top of page