ASP Spell Check Docs - JavaScript Object Reference

Attaching JavaScript Events to ASPSpellCheck

The scriptID property is used to allow you to attach JavaScript events to the spellchecker such as:

  • onDialogOpen ()
  • onDialogComplete ()
  • onDialogCancel ()
  • onDialogClose ()
  • onChangeLanguage (Language)
  • onIgnore (Word)
  • onIgnoreAll (Word)
  • onChangeWord (From, To)
  • onChangeAll (From, To)
  • onLearnWord (Word)
  • onLearnAutoCorrect (From, To)
  • onUpdateFields (arrFieldIds)

Events usage is covered in detail in the JavaScript Events Tutorial

Advanced JavaScript API

Thanks to our friends at javascriptspellcheck.com ASPSpellCheck can be instantiated and modified in full using JavaScript.

The first step is to instantiate the javascript API by calling the ASP initializeJavaScript() function in the header of the page:

<!--#include virtual="/ASPSpellCheck/ASPSpellInclude.inc"-->
	<%  
		dim myLink
		set myLink = new AspSpellLink
		response.write myLink.initializeJavaScript()
		set myLink=nothing
	%>

We now have full access to the JavaScript $Spelling object detailed below>

JavaScript API usage is also show in the JavaScript "Magic" Tutorial

JavaScript Primary Functions

Function Description
$Spelling.SpellCheckInWindow(Fields) Opens a spellchecking dialog window
  • Fields allows you to pick the fields you wish to spellcheck
$Spelling.SpellCheckAsYouType(Fields) Causes any texarea(s) to underline any misspelled words - and provides spelling suggestions on right click.
  • Fields relates allows you to pick the fields you wish to spellcheck
$Spelling.LiveValidation(Field,MessageElementId) Shows a warning message beside Field when it contains spelling errors.
  • Fields allows you to pick the fields you wish to to validate
  • MessageElementId is the id of the HTML element containing the warning message


Real-Time JavaScript Spell Checking Functions

Function Description
$Spelling.BinSpellCheck(input) Returns bool:
  • True if input is in the dictionary
  • False if it is not.
$Spelling.BinSpellCheckFields(Fields) Spell checks one or more fields in your page - and returns bool:
  • True if all fields are spelled correctly
  • False if the fields contain spelling errors.
$Spelling.SpellCheckSuggest(input) Returns an array of spelling suggestions for input.
$Spelling.ListDictionaries() Returns an array of currently installed dictionaries in your JavaScriptSpellCheck/dictionaries folder.

AJAX Spell Checking Functions

Function Description
o = $Spelling.AjaxSpellCheck(input);

o.onSpellCheck = function(result,suggestions){}

Spellchecks a word and asynchronously returns a boolean spellchecking result and suggestions.
o = $Spelling.AjaxSpellCheckFields(Fields)

o.onValidate = function(result){}

Spell checks one or more fields in your page - and returns asynchronously a boolean spellchecking result.
o = $Spelling.AjaxDidYouMean(string)

o.onDidYouMean = function(result){}

Asynchronously returns an suggestions string for a search box spell-checking phrase.

JavaScript Properties

Property Type Default Value Description
$Spelling.DefaultDictionary string "English (International)" The dictionary language used by JavaScript SpellCheck.
  • To use multiple dictionaries at once use a comma - "Espanol,Francais"
$Spelling.UserInterfaceTranslation string "en" Translates the context menu and spellchecker dialog into over 50 international languages.
$Spelling.ShowStatisticsScreen bool false Shows a statistics screen (word count, edit count) after SpellCheckInWindow.
$Spelling.SubmitFormById string "" Will submit a form (identified by its id attribute) once spellchecking once SpellCheckInWindow is complete.
$Spelling.Theme string "js.modern" Allows you to apply a CSS theme to change the appearance of JavaScript SpellCheck.
  • Corresponds to theme folder in /JavaScriptSpellCheck/themes
$Spelling.CaseSensitive bool true Spellchecker notices cAse mIstAkes
$Spelling.IgnoreAllCaps bool true Spellchecker ignores BLOCK CAPITAL letters which are often acronyms.
$Spelling.CheckGrammar bool true Spellchecker notices basic grammar mistakes such as sentence casing and repeated words.
$Spelling.IgnoreNumbers bool true Spellchecker ignores words with numbers in them like "High5" or "MSO7262BGO"
$Spelling.ShowThesaurus bool true Spellchecker shows a thesaurus and look-up-meaning link during SpellCheckInWindow
$Spelling.ShowLanguagesInContextMenu bool true Allows the user to pick a dictionary Language from all installed dictionaries during SpellCheckAsYouType
$Spelling.PopUpStyle string "modal" SpellCheckInWindow pop-up style:
  • "modal" - a modal dialog window
  • "modelss" - a modless dialog window
  • "popup" - a normal popup

JavaScript Events

Event Description Example
onDialogOpen() SpellCheckInWindow dialog pops up. o = $Spelling.SpellCheckInWindow('all')

o.onDialogOpen = function(){}

onDialogComplete() SpellCheckInWindow dialog completes successfully - user has not quit o = $Spelling.SpellCheckInWindow('all')

o.onDialogComplete = function(){}

onDialogCancel() SpellCheckInWindow dialog completes is quite by the user o = $Spelling.SpellCheckInWindow('all')

o.onDialogCancel = function(){}

onDialogClose() SpellCheckInWindow dialog closes for any reason o = $Spelling.SpellCheckInWindow('all')

o.onDialogClose = function(){}

onChangeLanguage(language) SpellCheckInWindow or SpellAsYouType language is changed by the user.
  • Language name is passed as a string
o = $Spelling.SpellCheckInWindow('all')

o.onChangeLanguage = function(language){}

onIgnore(word) A word is ignored by the user in wither SpellCheckInWindow or SpellAsYouType.
  • Word is passed as a string
o = $Spelling.SpellCheckInWindow('all')

o.onIgnore = function(word){}

onIgnoreAll(word) The user clieck 'Ignore All' for a word in either SpellCheckInWindow or SpellAsYouType.
  • Word is passed as a string
o = $Spelling.SpellCheckInWindow('all')

o.onIgnoreAll = function(word){}

onChangeWord(from,to) The user changes a word in either SpellCheckInWindow or SpellAsYouType.
  • "from" and "to" are passed as strings
o = $Spelling.SpellCheckInWindow('all')

o.onChangeWord = function(from,to){}

onChangeAll(from,to) The user clicks 'Change All' for a word in SpellCheckInWindow.
  • "from" and "to" are passed as strings
o = $Spelling.SpellCheckInWindow('all')

o.onChangeAll = function(from,to){}

onLearnWord(word) The user "Adds to Dictionary" in either SpellCheckInWindow or SpellAsYouType.
  • Word is passed as a string
o = $Spelling.SpellCheckInWindow('all')

o.onLearnWord = function(word){}

onLearnAutoCorrect(from,to) The user adds to autocorrect in SpellCheckInWindow.
  • "from" and "to" are passed as strings
o = $Spelling.SpellCheckInWindow('all')

o.onLearnAutoCorrect = function(from,to){}

onUpdateFields(arrFields) Any field is updated due to spellchecking.
  • arrFields is returned - an array of the Ids of all updated fields.
o = $Spelling.SpellCheckInWindow('all')

o.onUpdateFields = function(arrFields){}