Wintertree Spell Check Applet |
|
Home Site index Contact us Catalog Shopping Cart Products Support Search |
|
You are here: Home > Support > Wintertree Spell Check Applet > How to check text in non-Textarea text containers |
|
|
This article contains general advice on modifying Spell Check Applet to check text contained in text containers other than standard HTML Textareas (e.g., IFRAMEs, third-party text controls, etc.).
Spell Check Applet is implemented as two separate but cooperating components: the applet itself, and some JavaScript code contained in file SpellCheckApplet.js. The main role of the JavaScript code is to get the text to be checked from a Textarea, submit the text to the applet for checking, get the checked and corrected text from the applet, and put the corrected text back into the original Textarea.
Although the JavaScript code included with Spell Check Applet deals with standard HTML Text Areas only, it may be possible to modify the JavaScript code to work with other text containers. The JavaScript code is provided in source-code format, so modifications are certainly possible. However, any modifications you make to the JavaScript code are entirely your responsibility. Wintertree Software cannot help with any modifications you make, nor can we help with any problems that may arise in doing so. You will need to be familiar with JavaScript programming and with a JavaScript-accessible API supported by the text container you want to use.
The text container you want to use must support a JavaScript-accessible mechanism to get the plain text it contains, and another mechanism to replace the text. By "mechanism" we mean a method or function that can be called by JavaScript code. The mechanism to get the text must be able to copy the text into a JavaScript string, and the mechanism to replace the text must be able to receive the text from a JavaScript string. The text obtained from the container may contain HTML markups, but it should not contain other kinds of formatting (e.g., RTF).
The checkNextField JavaScript function in SpellCheckApplet.js gets the text from the text area and submits it to Spell Check Applet for checking in this statement:
appletLoc.SpellCheckApplet.setText(fieldsToCheck[curFieldToCheck].value);
fieldsToCheck[curFieldToCheck] contains a reference to the Textarea object; the ".value" attribute refers to the text contained by that object. Any changes needed to get the text from a text container would be made here. The statement both gets the text from the Textarea and submits it to the applet, without use of an intermediate string variable. Nevertheless, the text passes between the TextArea and the applet as a JavaScript string.
When the spelling check is complete, the waitForSpellCheck JavaScript function gets the corrected text from the applet and copies it to the original Textarea in this statement:
fieldsToCheck[curFieldToCheck].value = appletLoc.SpellCheckApplet.getText();
Again, fieldsToCheck[curFieldToCheck] contains a reference to the Textarea object, and the ".value" attribute refers to the text contained by that object. Assigning a string to the Textarea object's ".value" attribute replaces the contents of the Textarea with new text. Any changes needed to replace the text in the text container would be made here.
|
Home Site index Contact us Catalog Shopping Cart Products Support Search |
|
Copyright © 2015 Wintertree Software Inc. |