UltimateSpell Client-Side API

Spell Properties and Methods
API Element Description Example
UltimateSpells[ultimateSpellId] UltimateSpell object collection. UltimateSpells['UltimateSpell1']
UltimateSpells['<%=UltimateSpell1.ClientID%>']
UltimateSpells.UltimateSpell1
UltimateSpells.<%=UltimateSpell1.ClientID%>
[ultimateSpellId]_OnLoad() Function template to handle window onload events after the UltimateSpell control is completely loaded and ready to be reached by the UltimateSpells and UltimateSpellAsYouTypes collections on the client-side. function UltimateSpell1_OnLoad() {/* custom function */}
function <%=UltimateSpell1.ClientID%>_OnLoad() {/* custom function */}
ShowSpellDialog() Opens the spell check dialog box as if you clicked the Spell Check button. UltimateSpells['UltimateSpell1'].ShowSpellDialog();
ShowGrammarDialog() Opens the grammar check dialog box as if you clicked the Grammar Check button. UltimateSpells['UltimateSpell1'].ShowGrammarDialog();
ShowSynonymsDialog(controlId, strWord) Opens the synonyms dialog box.

controlId: String that specifies the client-side id of the input control.
strWord: String that specifies the word to retrieve the synonyms for.
UltimateSpells['UltimateSpell1'].ShowSynonymsDialog('TextBox1', 'test');
GetControlIdsToCheck() Gets ControlIdsToCheck property of the UltimateSpell control. alert(UltimateSpells['UltimateSpell1'].GetControlIdsToCheck());
SetControlIdsToCheck(controlIdsToCheck) Sets ControlIdsToCheck property of the UltimateSpell control.

controlIdsToCheck: String that specifies control ids to spell check.
UltimateSpells['UltimateSpell1'].SetControlIdsToCheck('TextBox1,TextArea1');
SpellAsYouType Properties and Methods
API Element Description Example
UltimateSpellAsYouTypes[textBoxId] UltimateSpellAsYouType object collection. UltimateSpellAsYouTypes['TextBox1']
UltimateSpellAsYouTypes['<%=TextBox1.ClientID%>']
UltimateSpellAsYouTypes.TextBox1
UltimateSpellAsYouTypes.<%=TextBox1.ClientID%>
SetFocus() Sets focus into the textbox. UltimateSpellAsYouTypes['TextBox1'].SetFocus();
AddEventHandler(eventName,functionNotify) Binds the specified function to an event so that the function gets called whenever the event fires on the textbox.

eventName: String that specifies any of the standard DHTML events. functionNotify: Pointer that specifies the function to call when eventName fires.

Note that eventName should not have 'on' as prefix. For example, if you want to add an event handler for onload, you should pass 'load' instead of 'onload'.
UltimateSpellAsYouTypes['TextBox1'].AddEventHandler('keydown', HandleKeyDown);

function HandleKeyDown() {
  alert('KeyDown event fired.');
}
RemoveEventHandler(eventName,functionNotify) Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.

eventName: String that specifies any of the standard DHTML events. functionNotify: Pointer that specifies the function to call when eventName fires.

Note that eventName should not have 'on' as prefix. For example, if you want to add an event handler for onload, you should pass 'load' instead of 'onload'.
UltimateSpellAsYouTypes['TextBox1'].RemoveEventHandler('keydown', HandleKeyDown);
GetEventKeyCode(event) Retrieves the Unicode key code associated with the key that caused the event.

event: Event object that represents the state of an event.
UltimateSpellAsYouTypes['TextBox1'].GetEventKeyCode(event);
CancelEvent(event) Cancels the event if it is cancelable so that any default action normally taken by the implementation as a result of the event will not occur.

event: Event object that represents the state of an event.
UltimateSpellAsYouTypes['TextBox1'].CancelEvent(event);
GetSpellText() Gets the text in the spell as you type textbox. var textStr = UltimateSpellAsYouTypes['TextBox1'].GetSpellText();
SetSpellText(textStr) Sets the text in the spell as you type textbox. UltimateSpellAsYouTypes['TextBox1'].SetSpellText('Hello world!');
GetCurrentRange() Gets the current range in the spell as you type textbox (refer to Internet Explorer documentation). var range = UltimateSpellAsYouTypes['TextBox1'].GetCurrentRange();
Position() Positions the spell as you type textbox. This method can be used to reposition the spell as you type textbox in cases where the page layout changes on the client-side after the page is loaded. UltimateSpellAsYouTypes['TextBox1'].Position();
Pause() Pauses the spell checking in a spell as you type textbox. This method can be used to temporarily pause the spell checking on the client-side. UltimateSpellAsYouTypes['TextBox1'].Pause();
Restart(restoreCursor) Restarts the spell checking in a spell as you type textbox. This method can be used to restart the spell checking if the text inside the text area is programmatically changed on the client-side.

restoreCursor: Boolean that specifies whether the cursor position is restored after the spell checking operation. The default is false.
UltimateSpellAsYouTypes['TextBox1'].Restart();
Resume() Resumes the spell checking in a spell as you type textbox. This method can be used to resume the spell checking on the client-side. UltimateSpellAsYouTypes['TextBox1'].Resume();
CleanSpellAsYouTypeFormat(htmlStr) Cleans spell as you type error SPAN elements in given HTML fragment. UltimateSpellAsYouTypes['TextBox1'].CleanSpellAsYouTypeFormat(htmlStr);
HasSpellingErrors() Returns a Boolean value that indicates whether the spell as you type textbox contains spelling errors. var hasSpellingErrors = UltimateSpellAsYouTypes['TextBox1'].HasSpellingErrors();
IsBusy() Returns a Boolean value that indicates whether the spell as you type functionality is currently busy with spell checking. var isBusy = UltimateSpellAsYouTypes['TextBox1'].IsBusy();