The 'rapidSpell' object can be used to code against, it is created automatically when the page loads and does not need to be declared or created manually.
Although inline spell checked text boxes are actually IFRAMEs (unless in static mode in which case they remain HTML text boxes), client scripting is the same; the onaction event handlers work and the .value property can be set.
To cancel events, such as keypress, for example to inhibit characters being added to a text box, handle the event and call rsw_activeTextbox.preventDefaultCurrentEvent(); to cancel the event.
For example to prevent characters like #, ' and \
document.getElementById('tb1').onkeypress = function (e) { var vRestrictedChars = [34, 35, 38, 39, 92, 220, 222]; var k = e.which; if ((vRestrictedChars.indexOf(k) >= 0)) { e.preventDefault(); e.cancelBubble = true; e.returnValue = false; rsw_activeTextbox.preventDefaultCurrentEvent(); } };
The spell checker fires certain events, which can be attached to via the addEventListener function, and removed from via removeEventListener(eventName, listenerFunction).
rapidSpell.addEventListener('ayt_textboxesinitialized', onInitialized); rapidSpell.addEventListener('ayt_spellcheckfinish', onFinish); rapidSpell.addEventListener('ayt_correction', onCorrection); rapidSpell.addEventListener('ayt_contextmenushowing', onMenuShowing); rapidSpell.addEventListener('ayt_contextmenushown', onMenuShown); //Other events are; ayt_finished_initializing, contextmenu. ... //called when the textboxes are ready for user input function onInitialized() {...} //called when spell check response comes from the server, the id of the textbox can be obtained //from textbox.shadowTB.id (for non static mode) function onFinish(textbox, complete, numberOfErrors){...} //called when a correction is made the id of the textbox can be obtained from textbox.shadowTB.id //(for non static mode), and data.errorWord has the error word, and data.replacement has the correction function onCorrection(textbox, data) {...} //called when the context menu is about to be shown //contextMenu is the context menu object, it includes .x and .y fields with it's position //activeTextbox is our internal class for the textbox, you might find something useful by browsing it's variables in your IDE //event the mouse/keyboard user event that caused the menu to be shown //spellingErrorElement is a span tag that is highlighting the error, usually it's the position of this where the menu should be shown function onMenuShowing(contextMenu, activeTextbox, event, spellingErrorElement ){...} //called when the context menu has been shown function onMenuShown(contextMenu, activeTextbox, event, spellingErrorElement ){...}
The spell checker fires certain events, which can be attached to via the addEventListener function, and removed from via removeEventListener(eventName, listenerFunction).
rapidSpell.addEventListener('dialog_finishedcheckingtextbox', onFinish); rapidSpell.addEventListener('dialog_correction', onCorrection); //Other events available are; dialog_finishedcheckingall, dialog_finishedcheckingtextbox, dialog_startedcheckingtextbox, dialog_correction, dialog_add ... //called when spell check on a text box finishes, the id of the textbox can be obtained //from textbox.id, complete indicates if it was completed or cancelled (false) function onFinish(src, textbox, complete){...} //called when a correction is made the id of the textbox can be obtained from textbox.id //wordStart is where the error occurs in the text, oldWord is the error and newWord is the correction function onCorrection(src, textbox, wordStart, oldWord, newWord) {...}