Basic steps to installation

This document prepared by Dynamic Drive

Step 1: Insert the below script into the HEAD section of your page:

<script language="JavaScript" type="text/javascript" src="richtext_compressed.js"></script>

**Note: Alternatively, you can insert the below code instead to reference the original, non compressed version of the .js file instead. This file is significantly larger than the compressed version, though the source is human readable:

<script language="JavaScript" type="text/javascript" src="richtext.js"></script>

Step 2: Inside the zip file you downloaded, upload the files:

1) The relevant .js file you have chosen above
2) The sole .css file included in the zip file
3) Palette.htm, blank.htm and insert_table.htm
4) The entire images directory

Upload the above to your web page directory, in the same directory where your form is in.

Step 3: Inside your form where you wish the rich text editor to appear, add the below code:

<script language="JavaScript" type="text/javascript">
<!--
//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('rte1', 'here&#39;s the "<em>preloaded</em> <b>content</b>"', 400, 200, true, false);
//-->
</script>

As you can see, you can control the initial content and dimensions of the rich text editor. "rtel" is the name of the text editor, which can be arbitrary but should be unique.

Step 4: Finally, just before the form containing the rich text editor is submitted, the script needs to sync the value contained within the editor to ensure it gets properly submitted. To archive this, a special function needs to be attached to the onSubmit event of your form. This is shown below:

<form name="myform" onsubmit="return submitForm();">

<script language="JavaScript" type="text/javascript">
<!--
function submitForm() {
//make sure hidden and iframe values are in sync before submitting form
updateRTE('rte1'); //use this when syncing only 1 rich text editor ("rtel" is name of editor)
//updateRTEs(); //uncomment and call this line instead if there are multiple rich text editors inside the form
alert("Submitted value: "+document.myform.rte1.value) //alert submitted value
return true; //Set to false to disable form submission, for easy debugging.
}

//Usage: initRTE(imagesPath, includesPath, cssFile)
initRTE("images/", "", "");
//-->
</script>

<!-rest of your form-->
"
"
</form>

Don't be intimated by Step 3. Basically, just add the above script containing function submitForm() to your form, and attach it to the onsubmit event handler inside the form tag.

Adding more than one rich text editor inside the form

You can easily add multiple rich text editors within the same form. Simply repeat Step 3 for each instance of an editor. Then, inside the script of Step 4, change:

updateRTE('rte1');

to call instead:

updateRTEs();

And that's it.