3rd Party text components can be used with RapidSpell Web. Html text box support is built in, but
other types of text components can be used if they allow Javascript to access their text. To use with an
Html text box simply set ignoreXML to true (this will mean HTML tags are ignored), set
TextComponentInterface to "HTMLTextBox" and set TextComponentName to the name of the component.
Page containing the RapidSpellWebLauncher Tag
.......................
<RapidSpellWeb:rapidSpellWebLauncher
rapidSpellWebPage="RapidSpellCheckerPopUp.jsp"
textComponentName="HTB"
ignoreXML="true"
textComponentInterface="HTMLTextBox"
/>
.......................
To use RapidSpell Web with other 3rd party components it is necessary to write a custom Javascript
interface which will perform two tasks for RapidSpell Web, it must get the text from the control and set text
to the control. To enable the use of a custom interface the TextComponentInterface property should be set
to “Custom”, and a Javascript (ECMAscript) block should be written into the form containing RapidSpell
Web (Launcher). As an example, a custom interface for the standard HTML text area will be built, to
demonstrate the concepts.
Firstly the RapidSpellWebLauncher control’s TextComponentInterface is set to Custom:
<RapidSpellWeb:rapidSpellWebLauncher id="rapidSpellWebLauncher"
textComponentName="myForm.tA"
mode="popup"
textComponentInterface="Custom"
ignoreXML="true"
rapidSpellWebPage="RapidSpellCheckerPopUp.jsp"/>
Next an interface must be written in Javascript, RapidSpell will expect a type RSCustomInterface to
be defined, of the following structure:
function RSCustomInterface(tbElementName){
this.tbName = tbElementName;
this.getText = getText;
this.setText = setText;
function getText(){
//return the text from the text component named
this.tbName,
//this may be HTML formatted text
return .........
}
function setText(text){
//set the text in the text component to the text argument
//this may be HTML formatted text
........
}
}
The two functions, getText and setText must be written to the specifications of the 3rd party component,
note that if they will return XML(HTML) formatted text that the RapidSpellWebLauncher property
ignoreXML should be set to true, otherwise the XML tags will be spell checked. In this example the interface
will be interfacing with a regular HTML <textarea> in which the text contained is accessed using the
format
document.formName.textAreaName.value
getText and setText can then be written as;
function getText(){
return eval('document.'+this.tbName+'.value');
}
function setText(text){
eval('document.'+this.tbName+'.value = text') ;
}
which dynamically accesses the text box named in the this.tbName variable. When RapidSpell runs it
instantiates an object of type RSCustomInterface using the Javascript line
var interfaceObjectName = new RSCustomInterface(_textComponentName);
where _textComponentName is specified by the property TextComponentName in
RapidSpellWebLauncher.
This gives the full code, for a custom interface as;
<%@ taglib uri="http://www.keyoti.com/" prefix="RapidSpellWeb" %>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<script>
function RSCustomInterface(tbElementName){
this.tbName = tbElementName;
this.getText = getText;
this.setText = setText;
function getText(){
return eval('document.'+this.tbName+'.value');
}
function setText(text){
eval('document.'+this.tbName+'.value = text') ;
}
}
</script>
</HEAD>
<BODY>
<form action='exampleTextBox10-Custom.aspx' method='post' name='myForm'>
<textarea name='tA'></textarea>
<br>
<RapidSpellWeb:rapidSpellWebLauncher id="rapidSpellWebLauncher"
textComponentName="myForm.tA"
mode="popup"
textComponentInterface="Custom"
ignoreXML="true"
rapidSpellWebPage="RapidSpellCheckerPopUp.jsp"/>
</form>
</BODY>
</HTML>