
There are several example templates and associated JavaScript library files located in the spellchecker directory.
Checking one or more textareas by argument (spellchecker/example.aspx):
<html>
<head>
<script language="JavaScript" src="spell.js"></script>
<title>Spell Checker Test Page</title>
</head>
<body>
<form name="myForm">
<textarea name="content" rows="14" cols="45">I am speled wrang</textarea><br>
<textarea name="content2" rows="14" cols="45">I am aalso spelled wrang</textarea>
<input type="button" value="Check Spelling" onClick="spell('document.myForm.content.value', 'document.myForm.content2.value')">
</form>
</body>
</html>
Spell Checking all textareas with a single button (spellchecker/example2.aspx):
<html> <script language="JavaScript" src="spellAll.js"></script>
</head>
<head>
<title>Spell Checker Test Page</title>
<body>
<form name="myForm">
<textarea name="content" rows="14" cols="45">I am speled wrang</textarea><br>
<textarea name="content2" rows="14" cols="45">I am aalso spelled wrang</textarea>
<input type="button" value="Check Spelling" onClick="spell()">
</form>
</body>
</html>
The spellAll.js library finds all textareas in the example above and sends references to the Foundeo Spell Checker object. (lines 23 - 30 of spellAll.js)
Spell Checking from form validation (spellchecker/example3.aspx):
<html>
<head>
<script language="JavaScript" src="spellInValidation.js"></script>
<script language="JavaScript">
function validation() {
// Cancel the submit event
window.event.returnValue = false;
// Sample validation
if(myForm.content == "") {
alert("Please enter some text.");
myForm.content.focus();
return false;
} else {
spell('myForm');
}
}
</script>
<title>Spell Checker Test Page</title>
</head>
<body>
<form name="myForm" action="myPage.aspx" method="post" onSubmit="validation()">
<textarea name="content" rows="14" cols="45">I am speled wrang</textarea><br>
<textarea name="content2" rows="14" cols="45">I am aalso spelled wrang</textarea>
<input type="submit" name="formButton" value="Save">
</form>
</body>
</html>
When spell checking from form validation, the submit event is cancelled to prevent the form from submitting before spell checking is complete. The form name is passed to the spell() function and used to submit the form after spell checking.
If the name of your submit button is "submit", an Object does not support property or method error is returned.