iTP Active Transaction Pages (iTP ATP) Programmer's Guide
ATP Web Page and Script Structure
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide—522292-002
3-12
Using NonStop TUXEDO Servers from JavaScript
Server-Side Functions
Example 3-6 (/examples/tuxedo/bankapp/transfer.atp) defines a
function called doTransfer to communicate with the NonStop TUXEDO
environment, just as the Pathway example defines the send_to_server function to
communicate with the Pathway servers. However, this example includes the function in
the web page, whereas the Pathway example uses an include file. Whether to define
the function in the page or in an include file is a matter of programming style. In
general, an include file is easier to incorporate into multiple applications and enforces
encapsulation: the web page designer need not be concerned with how the function is
implemented, only with how to call it. However, defining the function on the page has
the advantage of making the flow of operations easier to study.
function ValidateTransferForm (f) {
if (ValidateFromAccount (f.FromAccount) &&
ValidateToAccount (f.ToAccount) &&
ValidateTransferAmount (f.Amount))
if (FromIndex != ToIndex)
return true
else
alert ("From and To accounts must be different")
alert ("Form not submitted")
return false
}
</script>
</head>
<body>
Example 3-5. NonStop TUXEDO Definitions and Includes (page 2 of 2)