Oracle Forms is essentially a Java Applet running inside of a web page. RapidSpell Web Java is a web based spell checker, and so it is possible with some plumbing code, to use RapidSpell Web Java to do dialog (popup) based spell checking on Oracle Forms text fields.
In Oracle Forms it is possible to communicate with Javascript running on the web page that holds the Oracle Form.
We helped a customer achieve this recently and are looking to know how much interest there is generally for this.
1. Download the RapidSpell Web Java trial version.
2. Unzip the downloaded ZIP, and install RapidSpellDemo.war to the web application server (eg. WebLogic). If unsure how to do this, please follow the standard WebLogic instructions for WAR deployment. This step installs a simple JSP based demo application on the server, this is important because it contains servlets that the Oracle Forms page will use. You do not have to install RapidSpellDemo.war, instead you can follow the RapidSpell help instructions and create your own WAR, and deploy that.
Note:
It is vital that the WAR must be deployed to the same domain/servername as the one that the Oracle Forms page runs on. This is to prevent problems with browser security rules as the caller page communicates with the Servlet running on WebLogic.
Also, if NOT running under localhost you will need to install a license key. To do that obtain one here, and then edit the web.xml file inside of the WAR according to the licensing and deployment instructions in our help. You can edit files inside of a WAR by renaming the .war file to .zip, and then opening it with a ZIP program like WinRAR etc.
3. On the web page that holds your Oracle Form, add to the HEAD block
<script type="text/javascript" src="http://yourserver:7001/RapidSpellDemo/a.rapidspellweb?t=r&n=RapidSpell-DIALOG.js"></script>
<script type="text/javascript">
rapidSpell.dialog_popupURL='http://yourserver:7001/RapidSpellDemo/a.rapidspellweb?t=d';
rapidSpell.setParameterValue('default', 'UserDictionaryFile', '');
</script>
<script type="text/javascript">
function getfield()
{
return document.getElementById("field1").value;
}
function setValue(fieldval)
{
document.getElementById("field1").value=fieldval;
}
var haveAddedListener = false;
function spellcheck()
{
if(!haveAddedListener)
{
rapidSpell.addEventListener('dialog_finishedcheckingtextbox', onFinish);
haveAddedListener=true;
}
rapidSpell.dialog_spellCheck(true,'field1');
}
function onFinish(src, textbox, complete)
{
document.myApplet.raiseEvent("finish", textbox.id);
}
</script>
This code expects your “applet_name” in the Forms “Web Configuration” to be set to “myApplet” – please change it as required.
And, also before the </body> tag of the HTML page, add
<textarea style=”display:none;” value="" name="field1" id="field1"></textarea>
This hidden element will hold the text to be spell checked on the Javascript side of things.
4. In the PL/SQL side of your app, call the spell checker (in this case it is for a field named “COMMENTS”
declare
v_field_value varchar2(3000);
begin
v_field_value := replace(:COMMENTS,'''','\''');
v_field_value := replace(:v_field_value,chr(10),'\n');
v_field_value := replace(:v_field_value,chr(13),'\r');
:control.field_name := 'COMMENTS';
web.javascript_eval_expr('setValue('''||v_field_value||''')');
web.javascript_eval_expr('spellcheck()');
end; |