Embedding Auto SpellChecker Support (version with inline frames)
Revision 08-04-2002

 Download these instructions as PDF Document


The Auto SpellChecker system provides automatic spell checking for your website, with easy set up and integration.

Follow the steps in these four sections to add Auto SpellChecker support to your website:

  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.

.NET version contains additional files:

  • bin/sproxy.dll - compiled server-side logic;
  • Global.asax - application caching support;
  • Web.config - replacement for .ini-file.

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 (Web.config ) 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://www.spellchecker.net/support/getscript.html to download it.

c. SPROXY_URL should be replaced with the full URL of the sproxy.cgi file (There is no such setting in Web.config since it handles it automatically). For example, http://my_server.com/cgi-bin/sproxy.cgi.

d. 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

e. 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.

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

g. 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.

h. 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.

i. SPROXY.INI has two additional properties, which can be used to define the SpellChecker server list. You can define this server list, depending on your server geographic location and which SpellChecker server works faster with your server.

main_server contains the URL of the main SpellCheck server. "www.spellchecker.net" is default server.

Top of page

Modify HTML Pages

Modify the web page

Auto SpellChecker support can be embedded into a web page by adding an inline frame (IFRAME) that is supported by MS Internet Explorer version 4 and higher. For the technology compatible with other browsers please see our instruction for embedding SpellChecker using HTML frames.

1.  Add an inline frame to your frameset by entering the following html code:

<iframe name=AutoChecker src="SPROXY_URL?cmd=init" marginHeight=0 marginWidth=0 scrolling=no style="height:0;width:0;" frameborder="no"></iframe>

SPROXY_URL should be replaced with the actual URL of the sproxy.cgi file on your server.

2. Add the following code in the header (between "<head>" and "</head>" tags) of the page in which SpellChecker will be used:

<script>
<!--
var frmname = 'FORM_NAME ';
function SetEnabling_ASC(enbl)
{
   document.forms[frmname].enabling.checked = enbl;
}

function doSubmit_ASC(ctrl)
{
   if (!document['AutoChecker'])
      return true;
   if (document['AutoChecker'].checkText)
      return document['AutoChecker'].checkText(ctrl);
   else return !document.forms[frmname].enabling.checked;
}

function setOpts_ASC()
{
   document['AutoChecker'].adjustOptions();
}

function doLoad_ASC()
{
   if (document['AutoChecker'])
      if (document['AutoChecker'].isAutoSpellCheckEnabled)
         document.forms[frmname].enabling.checked =
            document['AutoChecker'].isAutoSpellCheckEnabled();
}

function enable_disable_ASC()
{
   document['AutoChecker'].setAutoSpellCheckEnabling(document.forms[frmname].enabling.checked);
}

//-->
</script>

FORM_NAME should be replaced with name of the form in which text control will be checked.

Layout Auto SpellChecker controls

Add to your web page the following code:

<script language="javascript">
<!--
if ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4)) {
   document.write('<br><input type="checkbox" name="enabling" onclick="enable_disable_ASC();" checked> Auto Spell Check.');
   document.write('<br><input type="button" onclick="setOpts_ASC();" value= "Options">');
}
//-->
</script>

This code will show the AutoSpellCheck controls only when viewed with a browser that supports inline frames.

Setting up the onLoad event

1. Find the <BODY> tag in your page.
2. Add the following code within this tag:

onLoad="return doLoad_ASC();"

If you already have the onLoad event handler in your page, add the above code inside the onLoad event.
For example:

Before changing
<body onLoad="doMyLoad()">

After changing
<body onLoad="doLoad_ASC(); doMyLoad()">
or
<body onLoad="doMyLoad(); doLoad_ASC()">

Setting up the onSubmit event

1. Find the <FORM> tag in your page. 
2. Add the following code to this tag:

onSubmit="return doSubmit_ASC(this['ELEMENT_NAME']);"

ELEMENT_NAME should be replaced with the name of the control text to be checked by Auto SpellChecker.

3. If the <FORM> tag has already onSubmit event, find all subsequent references to the onSubmit event (submit(), SomeFor.Submit(), document.forms[formname].Submit(), <input type=submit…> etc.) and replace them with the following code:

doSubmit_ASC(FORM_NAME['ELEMENT_NAME'])

For example:

Before changing:
......
<script>
<!--
......
function MyHandler()
{
......
if (SomeFlag)
{
 ......
  document.forms[SomeForm].submit();
}
else
{
......
}
......
document.SomeForm.submit();
}
......
//-->
</script>
......
<form name=SomeForm onSubmit="return MyHandler();" ......>
......
<textarea name=SomeText......>
......
</form>
......

After changing:
......
<script>
<!--
......
function MyHandler()
{
......
if (SomeFlag)
{
 ......
  doSubmit_ASC(document.Forms[SomeForm].SomeText);
  return false;
}
else
{
......
}
......
doSubmit_ASC(document.forms[SomeForm].SomeText);
return false;
}
......
//-->
</script>
......
<form name=SomeForm onSubmit="return MyHandler();" ......>
......
<textarea name=SomeText......>
......
</form>
......

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-2002 SpellChecker.net, Inc. All Rights Reserved.