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>
otWrite - used in an ASP page to transfer a variable's value
into the client page under construction.
Example:
<%@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.
Example:
/* 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 = window.open(...); /* open a blank window (no url)
to generate the report into.
The new window must have a name. */
form.target = w.name;
form.action = 'GenerateReport.asp';
form.submit();
/* 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.