Using Object Transfer Library

RSO POST utilizes the encoding of the Object Transfer Library (OT).  OT provides the encoding functionality on the client and server.  There are a few methods available beyond that which are used in RSO POST.  These methods can be used with or without RSO POST.

There are 3 files comprising the OT Library: ObjectTransferSupport.asp, ObjectTransfer.asp, and ObjectTransfer.htm. They should be kept in the same folder as the RS.ASP and RS.HTM files of RSO POST.

To include the OT Library into a page use
On the server: <!--#include file="...../_ScriptLibrary/ObjectTransfer.asp"-->
On the client: <script src="...../_ScriptLibrary/ObjectTransfer.htm" language=JavaScript></script>

Object Transfer Functions


otWrite - used in an ASP page to transfer a variable's value into the client page under construction.

<%@Language = JavaScript%>
var x = new Array;
for (var i = 0; i < 10; i++) {
x[x.length] = {'v' : i, 'v_times_2' : i*2};
otWrite ('ValueTable', x);

After the call to otWrite there will be a document-level variable called ValueTable which contains an array of objects, each with 2 fields - v and v_times_2. ValueTable is available to the client-side script immediately after it is sent so inline client script can begin accessing it.

otGetFormData - used to retrieve values submitted to the page from the client which uses otAddToForm (see below).  Each value submitted is contained in the associative array returned by otGetFormData(). See the client example of otAddToForm.


otAddToForm  (IE ONLY) - used to "stuff" a new or preexisting form with encoded data. The data is then posted to the server along with any other form data. The server uses otGetFormData() to retrieve the posted values. There are serveral reason why you might need to submit your data in this way.

  1. You already have a form that you are posting back to the server and you want to include some additional complex data in the transfer.
  2. You use InterDev's page object model (which employs a form called 'thisForm' on each page to preserve "page state". Post-backs are very common using this and sometimes you create additional complex data that you want sent back to the server in addition to the "page state" which is already there.
  3. You want to send some complex data to the server (like an RSO POST call), but the server is going to produce a page as the result of the data. You can post the data into another window/frame (or a new window). otAddToForm can even create the form dynamically if it's not already on the page. This is where the final parameter about cleaning out the form comes into play.  The form might be used over and over to post new data to new windows.  You don't want all the data accumulating.


/* CLIENT */
/* The form 'GenerateReportForm' doesn't yet exist on
the page the first time otAddToForm is invoked.
otAddToForm will create it and return the form object.
We also clean out the form in case
this is a second, third, etc use.*/
var someArray = /* some array of objects describing
fields desired on the report*/
/* Form Name = GenerateReportForm
Server "Variable" Name = ReportFields,
Value to send = someArray,
clear the form? = true (optional, defaults to false) */
var form = otAddToForm ('GenerateReportForm', 'ReportFields',
someArray, true);
var portrait = true; /* false for landscape */
otAddToForm ('GenerateReportForm', 'Orientation', portrait);
var w =; /* open a blank window (no url)
to generate the report into.
The new window must have a name. */ =;
form.action = 'GenerateReport.asp';
/* SERVER */
/* Get the posted data collection */
var data = otGetFormData();
var fields = data['ReportFields'];
var portraitOrientation = data['Orientation'];

otMakePackage/otDecodePackage - used to produce an encoded (string) value. You might find instances where you just can't pass the complex data that you need. These 2 functions will help you do that.

otMakeParameter/otDecodeParameter - function just like otMakePackage/otDecodePackage but also escape/unescape the encoded package. otMakeParameter is used by RSO POST to encode method arguments and return values.