Home 

Requirements 

Whats New 

Features 

Architechure 

Security 

License Agreement 


    Evaluation 

    Deployment 

    Using 

Interface 

ASP 

Submitting 

Customization 

Settings 

Programming 

DB Integration 

Image Library 

Custom Buttons 

Presentation 


    Contact Us 

 

ASP

With Active Server Pages or other server side technologies like .NET or ColdFusion, it is possible to write a function that simply creates a HTML Rich Text Area with one line of code. This is useful because it is simple to use and if you want to modify the way a HTML Rich Text Area is displayed then code need only be changed in one place.

All of the ASP code necessary to display a HTML Rich Text Area can be found in the inc/HTMLRichTextArea.asp file. This can be incorporated into your existing web site via a server side include (i.e. <!-- #include file="/inc/HTMLRichTextArea.asp" -->) or by simply copying and pasting the code into your web site's existing code library.

The ASP code automatically ensures that the HTMLRichTextArea.js is only included once per web page and that all characters that interfere with javascript's syntax are escaped using a backslash (\). e.g. Javascript delimits strings by using the apostrophe ('). If the default string also includes an apostrophe then a javascript syntax error will occur as it will have prematurely found the string delimiter. The ASP code avoids these issues by escaping apostrophes, carriage return and line feeds and the escape character (\).

To display a HTML Rich Text Area using the supplied ASP code do the following:

Response.Write(DisplayHTMLRTA("MyHTMLRTA","<h1>Test</h1>This is a test web page", "../inc/", 80,200))

An example of this output is seen below in which all of the ASP's functionality has been exercised.



DisplayHTMLRTA accepts the following parameters:

strNameHTML Name Tag of the HTML Rich Text Area. Do not included spaces in the name.
strDefaultInitial HTML to display
strHTMLRTAPathA path to the directory containing the HTMLRichTextArea.js file. Generally set to "/inc/" or "../inc/" or similar. It must end with a "/".
intWidthWidth of the HTML Rich Text Area. It is in percent if the HTMLRichTextAreaFactorySettings.js has SIZESINPERCENT set to true. Otherwise it is the size in pixels.
intHeightHeight in pixels of the HTML Rich Text Area
-
ReturnsThe HTML string representing the HTML Rich Text Area ready for Response.Write().

The ASP code generates a javascript variable called htmlrta[strName] that references the HTML Rich Text Area. e.g. If strName was passed in as 'Email' then a javascript variable is available called 'htmlrtaEmail'. This means that the HTML Rich Text Area's programmatic interface is available through javascript.

<%
   ...
   Response.Write(DisplayHTMLRTA("Demo",strText,"../../inc/HTMLRTA/",80,300))
%>

<input type="button" onclick="ChangeReadOnlyState()" value="Toggle Read Only">

<script LANGUAGE="javascript">
<!--
   var blnReadOnly = false;
   function ChangeReadOnlyState()
   {
      blnReadOnly = !blnReadOnly;
      htmlrtaDemo.MakeReadOnly(blnReadOnly);
   }
//-->
</script>;

For completeness the code found in HTMLRichTextArea.asp is displayed below. Be sure to edit this code to suit your environment.



(c) Copyright 2004
Sigma Solutions
tcpIQ is a member of the Sigma Solutions group