IBM Books

Reference

Hidden Variables


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

With hidden variables, you can reference variables while hiding the actual variable value in your HTML source. To use hidden variables:

  1. Define a variable for each string you want to hide.
  2. In the HTML block where the variables are referenced, use double dollar signs instead of a single dollar sign to reference the variables. For example, $$(X) instead of $(X).

Do not reference hidden variables with dynamically constructed variable names.

Example 1: Hidden variables in a HTML form

%HTML(INPUT) {
<FORM ...>
<P>Select fields to view:
<SELECT NAME="Field">
<OPTION VALUE="$$(name)"> Name
<OPTION VALUE="$$(addr)"> Address
.
.
.
</FORM>
%}
 
%DEFINE{
name="customer.name"
addr="customer.address"
%}
 
%FUNCTION(DTW_SQL) mySelect() {
  SELECT $(Field) FROM customer
%}
.
.
.

When the HTML form is displayed on a Web browser, $$(name) and $$(addr)are replaced with $(name) and $(addr) respectively, so the actual table and column names never appear on the HTML form and no one can tell that the true variable names are hidden. When the customer submits the form, the HTML(REPORT) block is called. When @mySelect() calls the FUNCTION block, $(Field) is substituted in the SQL statement with customer.name or customer.addr in the SQL query.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]