SteelBlue Tag Reference

This document describes each of the SteelBlue tags or HTML tags which are augmented by SteelBlue option flags. The tags are presented in the order in which they appear in the source code. Please see the
tag index for an alphabetical listing of the tags each with a brief description.

For each tag, the tag name is a link to the source code at which it is defined. To the far right of the tag name are listed the sections of a SteelBlue page (HTML, CHECK, ACTION, or ALL) in which the tag is available. After the title is a description of the tag.

Following the description is a usage section containing the tag syntax and a list of flags. In the tag syntax, square brackets are used to denote optional flags. Flags in parentheses and separated by pipes "|" denote that only one can be used in a particular tag. Names in the flag list are colored depending upon the type of string interpretation implemented upon the value of the flag. Names in BLACK denote no interpretation (i.e. the value used is exactly the value passed into the flag). Names in RED have variable substitution (i.e. if $i = "22", the string "$i + 2" becomes "22 + 2"). Names in GREEN have Eval interpretation (i.e. if $i = "22", the string "$i + 2" becomes "24")

After the usage section is an example of the tag in SteelBlue code and a list of related tags.


ACCUMULATEALL

Description:

Adds values to an array from the first column of a datasource. New entries from the datasource are appended to the end of the array, leaving the existing entries alone.

Usage:

<ACCUMULATE NAME="array name" [CLEAR]
   (ARRAY="array name"                         |
    FOR="number,number" [STEP="number"]        |
    SQL="SQL statement" [DB="connection_name"] |
    VALUE="string or list" [SPLIT="delimiter"])>
NAME-Name of array to which values are added
CLEAR-If specified, the array is cleared first
ARRAY-Name of array from which values are added
FOR-Starting and ending numbers through which to iterate
STEP-Size to skip between the FOR range (default 1)
SQL-Select statement whose first column is inserted into the array
DB- DB connection name
VALUE-A single value or a list inserted into the array
SPLIT-String used to separate elements in the value list

Example:

<!-- The following reads all the usernames from 
     the table "AuthUsers" into the array "users" 
     and then prints them out in a loop -->

<ACCUMULATE NAME=users 
            SQL="select username from AuthUsers">
The number of users are: 
<replace value="$users{LENGTH}">.
They are:
<loop name=userloop array=users>
  <replace value="$userloop{value}, ">
</loop> 

See Also: Data sources


DEFFUNContainerALL

Description:

Creates a new function which can be called from Eval blocks. In the FUNC flag, the variable name to the left of the equal sign is the return value of the function. Whatever value is in that variable when the control flow reaches the end of the DEFFUN container is the return result of the function. The function name is case insensitive, and the argument names are meant to be descriptive and do not need to correspond to any actual variables.

Usage:

<DEFFUN FUNC="$var=funcname($argv1,$argv2,...)">
FUNC-Prototype the function in the form: $var = funcname ($arg1, $arg2, ...)"

Example:

<!-- Define a function to concatenate two stsrings -->
<DEFFUN FUNC="$result = concatenate ($first, $second)">
  <assign name=$result value="$first$second">
</DEFFUN>

<eval>
  $a = "hi ";
  $c = concatenate ($a, 'there');
  print ($c);  // will print the string "hi there" 
</eval> 

See Also: EVAL


LOADALL

Description:

Retrieves previously saved data from the Swap into a namespace or an array. The Swap is a server-side repository of data associated with a particular user. Data is saved to the Swap with the SAVE command, or deleted with the CLEAR command. Any data already in the given namespace or array is cleared.

Usage:

<LOAD NAME=namespace
      (NAMESPACE=namespace |
       ARRAY=array         )>
NAME-The namespace or array into which data is placed
NAMESPACE-The name of the namespace to be restored
ARRAY-The name of the array to be restored

Example:

<assign name="$preferences{greeting}" value="Hi!">

<!-- Store preferences to the Swap -->
<SAVE NAMESPACE=preferences> 
  
<!-- Meanwhile, in a different file ... -->
<LOAD NAMESPACE=preferences>
<!-- The following prints "Hi!" even in a separate file -->
<replace value="$preferences{greeting}"> 

See Also: SAVE CLEAR


SAVEALL

Description:

Stores a namespace or an array into the Swap. The Swap is a server-side repository of data associated to a particular user (therefore data is not shared between users). Data can later be retrieved from the Swap with the LOAD command or deleted with the CLEAR command.

Usage:

<SAVE (NAMESPACE=namespace |
       ARRAY=array         )>
NAMESPACE-The name of the namespace to be stored
ARRAY-The name of the array to be stored

Example:

<ACCUMULATE NAME=users 
            SQL="select username from AuthUsers">
<!-- Store an array into the Swap -->
<SAVE ARRAY=users>
 
<!-- Meanwhile, in a different file ... -->
<LOAD ARRAY=users>
<LOOP name=userloop ARRAY=users>
  <replace value="$userloop{value}, ">
</LOOP> 

See Also: LOAD CLEAR


CLEARALL

Description:

Clears out an array or namespace from memory and the Swap. The Swap is a server-side repository of data associated to a particular user (therefore data is not shared between users). Data can be stored with SAVE and retrieved with LOAD.

Usage:

<CLEAR (NAMESPACE=namespace |
        ARRAY=array         )>
NAMESPACE-The name of the namespace to be deleted
ARRAY-The name of the array to be deleted

Example:

<ACCUMULATE NAME=users 
            SQL="select username from AuthUsers">
<!-- Store an array into the Swap -->
<SAVE ARRAY=users>
 
<!-- Meanwhile, in a different file ... -->
<CLEAR ARRAY=users> 
<!-- Now users is empty and LOAD with users will
     return nothing -->

See Also: LOAD SAVE


COPYALL

Description:

Copies an array or namespace from the SOURCE to the DESTINATION. If the source is an array, the data overwrites the destination array. If the source is a namespace, matching keys shared between the source and destination will be overwritten, but other keys will be maintained.

Usage:

<COPY SOURCE=name DESTINATION=name>
SOURCE-Namespace or array to be copied
DESTINATION-Namespace or array into which the copy is placed

Example:

<assign name="$a{a}" value="Hi">
<assign name="$a{b}" value="Rob">
<assign name="$b{b}" value="Kim">
<copy source=b destination=a>
<replace value="$a{a} $a{b}"> <!-- Hi Kim -->

See Also: ACCUMULATE


DECLAREALL

Description:

Declares a variable in the current scope. New scopes occur within LOOP and DEFFUN containers.

Usage:

<DECLARE NAME="$var" 
         (VALUE="value")>
NAME-Variable declared in the local scope.
VALUE-Value to set the variable. (Defaults to "".)

Example:

<assign name=$var value="global">
<replace value="$var ">   <!-- global -->
<loop value="1" name="x">
  <replace value="$var "> <!-- global -->
  <DECLARE name=$var value="local">
  <replace value="$var "> <!-- local -->
</loop>
<replace value="$var ">   <!-- global -->

See Also: REPLACE ASSIGN


ASSIGNALL

Description:

Assigns data to a variable. By default, the VALUE passes through simple string interpretation. If the EVAL flag is given, the VALUE flag is instead passed through the Eval interpreter.

Usage:

<ASSIGN NAME="$variable"
        VALUE="interpreted string or Eval block"
        [EVAL]>
NAME-The variable assigned
VALUE-Interpreted string or Eval block whose value is stored in the variable
EVAL-If given, the VALUE is passed through the Eval language interpreter

Example:

<assign name=$a value="Hello World">
<replace value="$a "> <!-- "Hello World " -->
<assign name=$a value="substr($a,3,2)" EVAL>
<replace value="$a "> <!-- "lo" -->

See Also: REPLACE DECLARE


LOGALL

Description:

Logs a string into a text file on the server. The data to be logged comes from the TEXT flag, and it is appended to the file named in the DefaultLog configuration variable.

Usage:

<LOG TEXT="logtext">
TEXT-Text that will be appended to the file given in the default-log configuration variable

Example:

<LOG TEXT="I see $USER{username}">

SQLALL

Description:

Executes an SQL statement and stores the first row (if any) into the given namespace. The data is stored into the namespace under the column names assigned by the database (therefore they may not match the column names given in the SQL statement). For cross database compatibility, the data is also stored under the column numbers (starting with 0) and the number of columns is stored in the key "LENGTH". Finally, the first column is also stored under the key "value".

If the SQL is not an insert or update and will return no rows of data, the NOFETCH flag should be used. Some, but not all, databases will generate errors if this is not done. For example, executing stored procedures with ORACLE will cause an error if the NOFETCH flag is not used.

Variables placed in the SQL statement which come from the $this or $last namespace are considered "tainted" and quotes occuring in them are automatically escaped depending upon the database used. All other namespaces are passed to the SQL statement.

ARGS can be used to specify a list of bind variables to the SQL statement. The syntax for the location in the SQL statement of the bound variable depends upon the database.

Usage:

<SQL NAME="namespace" [DB="connection_name"]
     SQL="SQL statement" [NOFETCH] [DEBUG]
     [ARGS="$arg1,$arg2,..."]>
NAME-Namespace to which the first row (if any) is stored
SQL-SQL to be executed
DB- DB connection name
NOFETCH-Indicates no rows will be returned (not needed for insert or update)
DEBUG-Causes an HTML comment to be printed with the SQL (only in an HTML section)
ARGS-Variable names to be bound in the SQL statement separated by commas

Example:

<sql sql="select USERNAME, PASSWORD from AuthUsers"
     name="user">
<replace value="$user{USERNAME} $user{PASSWORD} "><br>
<replace value="$user{0} $user{1} "><br>
<replace value="$user{value}" <!-- same as $user{0} -->

See Also: Data sources LOOP


IFALL

Description:

Allows conditional execution of SteelBlue code. The section between the initial IF and the following ELSEIF, ELSE, or /IF tag is executed if the expression in the BOOL tag evaluates to a string other than "" or "0". Otherwise code between the ELSE (or optional ELSEIF) and /IF is executed.

INPUT and TEXTAREA elements in both the IF and ELSE sections of an IF statement are automatically checked for datatypes on the server when the data is submitted. Therefore INPUT and TEXTAREA elements in IF statements should not have the REQUIRED flag.

Usage:

<IF BOOL="eval phrase">
  Then clause
<ELSEIF BOOL="eval phrase">
  Elseif clause             
 <!-- Additional ELSEIF clauses ... -->
<ELSE>
  Else clause               
</IF>
BOOL-Eval boolean expression (false if either "" or "0")

Example:

<!-- Determines if a user is in the admin group -->
<if bool="group('admin')">
  You are in the admin group!
</if>

<!-- Does different actions based upon $choice -->
<if bool="$choice eq ''">
  You didn't choose anything
<elsif bool="$choice eq 'dog'">
  You chose dog
<else>
  You chose something else
</if> 

LOOPContainerALL

Description:

Iterates over multiple rows of data. For each row of data, the namespace given in NAME is populated with the data and the code in the LOOP container is executed. For SQL statements, the data is stored into the namespace under the column names assigned by the database (therefore they may not match the column names given in the SQL statement). For all datasources, the data is stored under the column numbers (starting with 0) and the number of columns is stored in the key "LENGTH". Finally, the first column is also stored under the key "value".

Variables placed in the SQL statement which come from the $this or $last namespace are considered "tainted" and quotes occuring in them are automatically escaped depending upon the database used. All other namespaces are passed to the SQL statement.

Form elements placed inside a LOOP automatically have a loop name and number appended to their name (this can be overridden for INPUT boxes with the STATIC flag). This allows input boxes to be easily manipulated within LOOPS.

LOOPS placed in the HTML section can be replayed in the HTML, CHECK, and ACTION sections. This is done by using a LOOP tag with the same namespace as the original LOOP, but with no datasource. A replayed loop does not populate the namespace with data, but is used to access user data created by form elements in loops. If loops are nested, the flag SAVELOOPINFO is required in the inner loops so that replay data is stored.

Usage:

<LOOP NAME="namespace"
   (ARRAY="array list"     [SPLIT="delimiter"]    |
    FOR="number,number"    [STEP="number"]        |
    SQL="SQL statement"    [DB="connection_name"] |
    (BOOL|WHILE)="Boolean statement"
    VALUE="string or list" [SPLIT="delimiter"])
    [SAVELOOPINFO]>
   ...
</LOOP>
NAME-Name of array to which data rows are copied
ARRAY-Array name or list from which rows are copied
FOR-Starting and ending numbers through which to iterate
STEP-Size to skip between the FOR range (default 1)
SQL-Select statement from which rows are copied
BOOL-Loop is repeated while the statement is true
WHILE-Loop is repeated while the statement is true
DB- DB connection name
VALUE-A single value or a list from which values are copied
SPLIT-String used to separate elements in the value or array list

Example:

<HTML>
 <BODY>
  <SHOWERRORS>
  <SBFORM name="myform" SCREEN="welcome.sb">
   <!-- Create an edit box for every user -->
   <LOOP SQL="select USERNAME
              from AuthUsers" NAME="users">
    <input name="username" value="$users{USERNAME}">
    <br>
   </LOOP>
   <input type="submit">
  </SBFORM>
 </BODY>
</HTML>

<CHECK>
  <SBFORM name="myform">
   <!-- Replay the loop and print out the user input -->
   <LOOP NAME="users">
    <error text="You entered $this{username}">
   </LOOP>
  </SBFORM>
</CHECK>
<!---------------------------------------------------->
<!-- Another example.  This one uses the FOR tag    -->
<!---------------------------------------------------->
<HTML>
<loop name="i" for="0,2">
 <loop name="j" for="1,9" STEP=4>
  <replace value="$i{0}, $j{0}"><br>
 </loop>
</loop>
</HTML>
<!-- The above loop generates the output:
       0, 1
       0, 5
       0, 9
       1, 1
       1, 5
       1, 9
       2, 1
       2, 5
       2, 9
                                            -->


See Also: Data sources SQL


EMAILALL

Description:

Sends e-mail using the sendmail program. The first column of the datasource is used as a list to whom e-mail is sent. The path to the sendmail executable should be set in the configuration element "MailProg".

Usage:

<EMAIL MESSAGE="message"
   [FROM="from"]
   [SUBJECT="subject"]
   [CONTENTTYPE="contenttype"]
   (ARRAY="array"                               |
    SQL="SQL statement" [DB="connection_name"]  |
    VALUE="string or list" [SPLIT="delimiter"])>
MESSAGE-Message to be sent
FROM-E-mail from whom the mail is sent
SUBJECT-Subject of the e-mail
CONTENTTYPE-Specify a different content-type for the e-mail
ARRAY-Array name of e-mail recipients
SQL-Select statement for e-mail recipients
DB- DB connection name
VALUE-Single value or list of e-mail recipients
SPLIT-String used to separate elements in the value list

Example:

<EMAIL VALUE="user@localhost.com"
       SUBJECT="Welcome to SteelBlue"
       MESSAGE="Hi!">

See Also: Data sources


DBCONNECTALL

Description:

Creates a new connection to a database. Other commands that use datasources can use the resulting connection by setting the DB tag to the connection name defined in the DBCONNECT command (for example: LOOP, SQL, EMAIL, and DBSELECT). The initial SteelBlue database connection is given the DB connection name "default".

The other flags correspond to their respective file configuration tag names. (Please see the configuration section for more details.) If a flag is not given, the associated file configuration option prepended with the connection name is used. If the configuration option is not defined, then the associated file configuration option with no prefix is used. For example, if the DB connection name is "Magic", and the USEDB flag is not given, then the file configuration option "MAGICUSEDB" is used. If "MAGICUSEDB" is not defined, then the file configuration option "USEDB" is used. Remember that file configuration options are case insensitive, so the DB connection names "JOBS" and "Jobs" would use the same file configuration options if the respective flags are not defined.

Please note that the SteelBlue executable must be compiled to use the database given in the USEDB flag.

Usage:

<DBCONNECT DB="connection_name"
   [USEDB="db_type"]
   [DBSYSTEM="system_name"]
   [DBUSERNAME="username"]
   [DBPASSWORD="password"]
   [DBNAME="db_name"]>
DB-Name associated with the resulting database connection
USEDB-Type of database (ORACLE MSQL MYSQL ODBC PGSQL SYBASE)
DBSYSTEM-System on which database resides
DBUSERNAME-Database username
DBPASSWORD-Database password
DBNAME-Name of tablespace or database to which to connect

Example:

If the file configuration had the options:

UseDb      = ORACLE
DBSystem   = localhost
DBUsername = foo
DBPassword = mypwd
DBName     = CALENDAR
JOBSUseDb  = MYSQL
JOBSDBName = OURJOBS

<DBCONNECT DB="Jobs">
<!-- Connects to the OURJOBS MySQL database
     on localhost using the username "foo" and
     password "mypwd" -->
<DBCONNECT DB="Magic" DBUseDB="MYSQL" DBUsername="www"
           DBPassword="" DBSystem="foo.com" 
           DBName="Magic">
<!-- Connects to the Magic MySQL database on
     foo.com using the username "www" and the
     password "" -->

<SQL SQL="select * from Person where person_id=2" 
     DB=Jobs NAME="people">
<!-- Does a query on the Jobs database connection -->

ABORTALL

Description:

Aborts the currently executing section, and skips to the next (if applicable). If ABORT occurs in an HTML section, the ending </HTML> tag is sent and the processing ends. If the ABORT occurs in a CHECK section, if an ERROR has been trhown, the previous HTML section is re-executed immediately, otherwise the ACTION section is executed. If an ABORT occurs in an ACTION section, if an ERROR has been thrown, the previous HTML section is re-executed immediately, otherwise the destination HTML section is executed.

Usage:

<ABORT>

Example:

<HTML>
 <BODY>
  <if bool="!group('admin')">
   <h2>
    You must be an administrator to execute
    this page
   </h2>
   <ABORT>
  </if>
  Do something sensitive...
 </BODY>
</HTML>

LOGOUTALL

Description:

Logs the user out by invalidating the ticket. The user will then need to log in again in order to access the SteelBlue application.

Usage:

<LOGOUT>

Example:

<LOGOUT>

INCLUDEALL

Description:

Includes SteelBlue code from a separate file specified by FILE (relative to the BasePages directory). The included file is treated as if it were physically placed at the location of the INCLUDE command. If JSESCAPE is specified, then the file is not interpreted, but instead is escaped for use as a JavaScript string.

Usage:

<INCLUDE FILE="filename" [JSESCAPE]>
FILE-SteelBlue code filename (relative to the BasePages directory)
JSESCAPE-Includes file as a constant escaped string for use in JavaScript

Example:

<!-- The following will include a SteelBlue code 
     file which contains a navigation bar common
     to many pages -->
<include file="navigation_bar.sb">

EVALContainerALL

Description:

Allows a large block of Eval code to be executed. The Eval language is well suited to quickly execute series of conditional statements, assignments, and loops.

Usage:

<EVAL>
  Eval Language Block
</EVAL>

Example:

<!-- Prints 10 elements of the Fibinocci 
     series -->
<EVAL>
  $a = 0;
  $b = 1;
  for($i=0;$i<10;$i=$i+1){
    $c = $a + $b;
    print("Fib[".$i."] = ".$c."<br>");
    $a = $b;
    $b = $c;
  }
</EVAL>

COMMENTContainerALL

Description:

Allows a comment to be written that does not go into the HTML stream. In order to support the use of comments to hide JavaScript, standard HTML comments are passed into the HTML stream.

Usage:

<COMMENT>
  Comment
</COMMENT>

Example:

<COMMENT>
 This does not appear in the HTML stream
</COMMENT>
<!-- This does appear in the HTML stream -->

SBSELECTHTML

Description:

Creates a single selection or multi-selection list from a list of values, arrays or an SQL statement. On an error, the selected values are automatically restored. If the datasource has only one column that column is used for both the options and the displayed strings for the selection list. If two columns are returned, the first column is used for the displayed strings and the second column is used for the internal option values. For multi-column datasources, the column used for the option values can be changed with OPTION (which defaults to 1) and the column used for the displayed strings can be changed with KEY (which defaults to 0).

If the MULTIPLE flag is not used, a single select list is generated. A single default value can be specified with the DEFAULT flag. In the CHECK and ACTION sections, the value selected by the user is placed in the variable $this{name}, where name is given by the NAME flag.

If the MULTIPLE flag is used, a multi-select list is generated. A set of default values can be specified by naming an array in the DEFARRAY flag. In the CHECK and ACTION sections, the values selected by the user are placed in the array $name, where name is given by the NAME flag.

There are times when a datasource does not provide a "not selected" or "none" option (for example an SQL statement selecting people's names). Such an option can be added with the NONE flag. The value in NONE is used as both the option value and the displayed string. If NONEVAL is also given, the NONEVAL is used for the option value, and NONE is used for the displayed string.

All other standard HTML flags (like SIZE, ONCHANGE, etc.) are added to the generated SELECT tag.

Usage:

<SBSELECT NAME="name"
   (ARRAY="array list"     [SPLIT="delimiter"]    |
    FOR="number,number"    [STEP="number"]        |
    SQL="SQL statement"    [DB="connection_name"] |
    VALUE="string or list" [SPLIT="delimiter"])
   [NONE="none_option" [NONEVAL="none_value"]]
   [EDITABLE=EvalExp]
   [MULTIPLE]
   ([DEFAULT="value"] | [DEFARRAY="array"])
   [KEY="columnname"] [OPTION="columnname"]>
NAME-The name of the resulting selection object
ARRAY-Array name or list for select options
FOR-Starting and ending numbers for select options
STEP-Size to skip between the FOR range (default 1)
SQL-SQL statement for select options
DB- DB connection name
VALUE-A single value or a list for select options
SPLIT-String used to separate elements in the value or array list
NONE-Additional option string not available in the datasource
NONEVAL-Additional option value associated with NONE
MULTIPLE-If given, multiple values may be selected by the user (results recorded in an array)
DEFAULT-Single option selected by default
DEFARRAY-Array containing default selecte doptions for a mult-select list
KEY-Provides an alternate column name to be used for the displayed options
OPTION-Provides an alternate column name to be used for the internal select option
EDITABLE-Boolean Eval expression to state if widget should be displayed or just the value (BETA)

Example:

<accumulate name="colorval" 
   value="1,2,3" split=",">
<accumulate name="colorname" 
   value="red,blue,green" split=",">
<accumulate name="selcolors"
   value="1,3" split=",">

<sbselect name="color" array="colorname,colorval"
   split="," NONE="black" NONEVAL=0 
   defarray="selcolors" MULTIPLE>

<!-- This creates the following:
 <select name=color MULTIPLE>
 <option value="0">black
 <option value="1" SELECTED>red
 <option value="2">blue
 <option value="3" SELECTED>green
 </select>
 The resulting values are placed in the array
 "color" in the CHECK and ACTION sections.
-->

<sbselect name="favorite_color" array="colorname"
   NONE="black" default="red">

<!-- This creates the following:
 <select name=favorite_color>
 <option value="black">black
 <option value="red" SELECTED>red
 <option value="blue">blue
 <option value="green">green
 </select>
 The resulting values are placed in the variable
 $this{favorite_color} in the CHECK and ACTION sections.
-->

See Also: Data sources SBFORM


SHOWERRORSHTML

Description:

By default, errors occuring in the CHECK or ACTION sections appear at the bottom of the HTML page. If SHOWERRORS is used in the HTML section, the error list will instead be placed there in the format given by the SHOWERRORS flags.

Usage:

<SHOWERRORS [HEADER="html"] [PREITEM="html"]
    [POSTITEM="html"] [FOOTER="html"]>
HEADER-HTML to proceed the set of errors (defaults to <font size+1><ul>)
PREITEM-HTML to proceed each individual error (defaults to <li>)
POSTITEM-HTML placed after each individual error (defaults to </li>)
FOOTER-HTML placed after the set of errors (defaults to </ul>)

Example:

<HTML>
 <BODY>
  <showerrors header="<table border=1>" 
              footer="<table>" 
              preitem="<tr><td>" 
              postitem="</td></tr>">
  <sbref screen="welcome.sb">
    Press to make an error
  </sbref>
 </BODY>
</HTML>
<CHECK>
 <ERROR text="This is an error">
 <ERROR text="This is another error">
</CHECK>

See Also: ERROR


INPUTHTML

Description:

Creates a form element and automatic server and client side type checking (if applicable).

As in standard HTML, the name of the INPUT element is given by NAME. However, if an INPUT is in a LOOP, a loop key is appended to the name in the form "_loop name_iteration" (multiply embedded loops cause multiple loop keys). This allows inputs to be easily supported inside of LOOPS. The appending of loop keys can be suppressed with the STATIC flag.

The type of input box is given by the TYPE flag. If the TYPE is TEXT a DATATYPE can be specified. DATATYPES supported for client side type checking (via JavaScript) include:

Client-side Datatypes
DatatypeFormatExample
DATEMM/DD/YY, MM/DD/YYYY2/1/1972
EMAILusername@host.domain (extra hosts supported)auser@steelblue.com
FLOATDigits with zero or one decimal points3.14
FUTUREDATEDate, but in the future11/2/2010
MONEYDigits possibily beginning with $ containing zero or one a decimal point$20.00
NUMBERDigits512
PASTDATEDate, but in the past3/4/1980
PERCENT## or %##%50
PHONENumbers, parentheses and dashes(717) 123-4567
SSN######### or ##-##-####12-34-5678
SHORT_TIMEHH:MM (HH between 1 and 12)5:30
TIMEHH:MM or HH:MM (AM|PM)2:20 PM

For client side type checking the configuration option "CheckUtil" should be set to point to the CheckUtils.js JavaScript file. You can create a new datatype for client side checking by adding the function checkTYPE in CheckUtils.js and by looping over the elements in the object TYPEgroup in the function checkFormDatatypes() (where "TYPE" is the name of the new datatype in all capital letters).

Server side type checking includes:

Server-side Datatypes
DatatypeFormatExample
DATEMM/DD/YY, MM/DD/YYYY2/1/1972
EMAILusername@host.domain (extra hosts supported)auser@steelblue.com
TIMEHH:MM or HH:MM (AM|PM)2:20 PM

You can create a new datatype for server side checking by adding the function Check::checkTYPE in Check.cpp and Check.h, and by adding the call to checkTYPE in Check::processINPUT().

The maximum and minimum lengths of the value can be enforced with the flags MAX and MIN respectively. If the datatype is NUMBER, MAX and MIN are used to determine the maximum and minimum values. In addition, the value must be non-empty upon submission if the REQUIRED flag is specified. However, if the value is empty upon submission, an alternative value can be supplied with the !VALUE flag. (This can be used to supply a value for checkboxes if they are not checked).

If an error occurs in type checking, an appropriate message is displayed. By default, the description for the input box is determined by the NAME flag. However, an alternative description can be given with the DESC flag.

If the TYPE is CHECKBOX or RADIO, the use of CHECKED is not suggested. Instead, a boolean Eval expression can be specified in either the CHECK or !CHECK flag. The input element is checked if CHECK is true or !CHECK is false.

In the CHECK, ACTION, and following HTML section, the value of the input box is stored in $this{name}. The values of input boxes in loops (without the STATIC flag) can be retrieved with $this{name} in a respective replayed loop (see LOOP). However, if multiple checkboxes or text boxes share the same name (unless they are in LOOPS) the MULTIPLE flag should be specified. If MULTIPLE is given, the values are placed in an array $name, where "name" is given by the flag NAME.

If the TYPE is FILE, the filename specified in the input box is placed in $name{filename}, the content type is placed in $name{contenttype}, and the file contents are placed in $name{data}, where "name" is given by the flag NAME. In order for file upload to properly work, you must add ENCTYPE="multipart/form-data" to the surrounding SBFORM tag.

If the TYPE is SUBMIT, an alternative destination screen can be given with the flag REDIRECT. If the form subission is successful, the screen given by REDIRECT will be displayed instead of the SCREEN given in the SBFORM tag (see SBFORM).

If an error occurs in the CHECK or ACTION sections of a SteelBlue page, the form is redisplayed, and input values are properly restored to those values chosen by the user at the time of submission.

Usage:

<INPUT [TYPE=(CHECKBOX | RADIO | SUBMIT | BUTTON |
              RESET | FILE | TEXT)]
       NAME=name [STATIC] [VALUE=value]
       [!VALUE=value] [MAX=number] [MIN=number]
       [(CHECK=EvalExp | !CHECK=EvalExp)]
       [DATATYPE=datatype] [MULTIPLE] [REQUIRED]
       [REDIRECT=screen]
       [EDITABLE=EvalExp]
       [DESC=description]>
TYPE-Type of input element
NAME-Name of input element
STATIC-Suppresses appending the loop key onto the element name
VALUE-Default value of input element
!VALUE-Value set if value is empty upon submit
MAX-Max length (or value if DATATYPE is NUMBER)
MIN-Min length (or value if DATATYPE is NUMBER)
CHECK-Boolean Eval expression to state if a radio button or checkbox is checked
!CHECK-Alternative boolean Eval expression to state if a radio button or checkbox is checked
DATATYPE-Allows automatic client or server side type checking
MULTIPLE-Allows multiple input elements with the same name
REQUIRED-If given, the value must be non-empty when submitted
REDIRECT-Changes destination screen for SUBMIT buttons
EDITABLE-Boolean Eval expression to state if widget should be displayed or just the value (BETA)
DESC-Description used in error messages

Example:

<input name="user_email" datatype="email"
       type="text" size=30 max=30 REQUIRED>

<input name="likes_spam" check="$likes_spam eq 'Y'"
       type="checkbox" value="Y" !value="N">

<input name="color" check="$color eq 'red'"
       type="radio" value="red" MULTIPLE> Red <br>
<input name="color" check="$color eq 'blue'"
       type="radio" value="blue" MULTIPLE> Blue
<!-- The results of the above checkboxes are placed
     in the array "color" containing the checked
     values in the CHECK and ACTION sections -->

See Also: SBFORM


TEXTAREAContainerHTML

Description:

Creates a textarea input box and automatic server and client side length checking (if applicable).

As in standard HTML, the name of the TEXTAREA element is given by NAME. However, if an TEXTAREA is in a LOOP, a loop key is appended to the name in the form "_loop name_iteration" (multiply embedded loops cause multiple loop keys). This allows textareas to be easily supported inside of LOOPS.

The default value of the textarea should be placed in the TEXTAREA container. The maximum and minimum lengths of the submitted value can be enforced with the flags MAX and MIN respectively. In addition, the value must be non-empty upon submission if the REQUIRED flag is specified.

In the CHECK, ACTION, and following HTML section, the value of the textarea is stored in $this{name}. The values of textareas in loops (without the STATIC flag) can be retrieved with $this{name} in a respective replayed loop (see LOOP). However, if multiple textareas share the same name (unless they are in LOOPS) the MULTIPLE flag should be specified. If MULTIPLE is given, the values are placed in an array $name, where name is given by the flag NAME.

If an error occurs in type checking, an appropriate message is displayed. By default, the description for the textarea is determined by the NAME flag. However, an alternative description can be given with the DESC flag.

If an error occurs in the CHECK or ACTION sections of a SteelBlue page, the form is redisplayed, and textarea values are properly restored to those values chosen by the user at the time of submission.

Usage:

<TEXTAREA NAME=name [VALUE=value]
   [MAX=num] [MIN=num] [REQUIRED]
   [MULTIPLE] [DESC=description]>
</TEXTAREA>
NAME-Name of input element
VALUE-Default value of input element
MAX-Max length
MIN-Min length
REQUIRED-If given, the value must be non-empty when submitted
MULTIPLE-Allows multiple input elements with the same name
DESC-Description used in error messages

Example:

<TEXTAREA name="NOTES"
   DESC="Important Notes" COLS=60 ROWS=5
   MIN=20>Place notes here</TEXTAREA>

See Also: SBFORM


SBREFContainerHTML

Description:

Creates a link to another SteelBlue page. The CHECK and ACTION sections of the calling page are first processed before the HTML section of the destination page (given in SCREEN) is executed.

Values in the $this namespace in the CHECK, ACTION, and destination HTML section can be set using the CLICK and SET flags. The CLICK flag sets $this{click} with the given value. The SET flag supplies a set of tag and value pairs in the form "tag1=value1;tag2=value2;...". This results in $this{tag1} being set to "value1", $this{tag2} being set to "value2" and so on. Note that SET and CLICK options are implemented in the URL, and therefore can be changed by the user.

If SBURL is specified, is contents is evaluated as an Eval expression and the result used as the URL to the SteelBlue executable. This can be used to switch between secure and insecure copies of the site for example. To promote ease of code transportability, it is strongly encouraged that possible values for SBURL are stored in the configuration file and retrieved by a call to getConfig().

Other tags are passed to the resulting A tag, however ONMOUSEOVER, ONMOUSEOUT, and ONCLICK first have variable interpretation

Usage:

<SBREF SCREEN="filename" 
       [SBURL=eval_exp]
       [CLICK=value]
       [SET="tag1=value1;tag2=value2;..."]>
 Link Text
</SBREF>
SCREEN-Destination SteelBlue filename (relative to BasePages) of the link
SBURL-Eval expression specifying an alternate SB executable URL
CLICK-Value to be set to $this{click}
SET-Pairs of tags and values to be set in the this namespace

Example:

<SBREF screen="welcome.sb">
 Back to welcome page
</SBREF>

See Also: REDIRECT


CACHEContainerHTML

Description:

Caches SteelBlue output to a file for faster future retrieval. The cache files are created in the directory specified by "CacheDir" SteelBlue configuration entry. In the cached output, the user's ticket is properly restored. CACHE tags inside of CACHE tags are not supported.

If BOOL is given and evaluates to "0" (false), then the contents of the CACE tag will be executed but not cached (even if a cache file already exists).

If EXPIRES is given, the cached data will expire after the number of hours given in EXPIRES. If EXPIRES="0", then the cached data never expires (unless the script file is modified). EXPIRES defaults to "0" if neither EXPIRES nor MODIFYDATE is given.

If MODIFYDATE and MODIFYTIME is given, then the cache file expires if the MODIFYDATE and MODIFYTIME is after the write date of the cache file. If MODIFYDATE is given without MODIFYTIME, then MODIFYTIME defaults to "11:59 PM".

If the SteelBlue script file is modified, then cached files associated with that script expire. Since INCLUDE files are determined at run-time, their modification time cannot be checked against the modification time of the cache file.

If a CACHE tag with no arguments follows a CACHE tag, then a new section of the same file is used. This allows data which cannot be cached to be interspersed with data which can be cached.

Usage:

<CACHE [NAME="cachename"] [INDEX="cacheindex"]
       [BOOL="boolean exp"]
       [EXPIRES="exphours"] 
       [MODIFYDATE="moddate" [MODIFYTIME="modtime"]]>
 ... Tags to cache ...
</CACHE>
NAME-Name prefix given to the cached data (defaults to the script filename)
INDEX-Index of the cached data (defaults to "")
BOOL-If false then the contents will be run but not cached
EXPIRES-Hours from which the cached data expires
MODIFYDATE-Last modification date of cached data
MODIFYTIME-Last modification time of the cached data

Example:

<CACHE NAME="toolbar" INDEX="$USER{username}"
       EXPIRES=24>
 Tags to be cached (expires after a day)
</CACHE> 

 Tags which cannot be cached

<CACHE>
 New section of the first CACHE file
</CACHE>

IMGHTML

Description:

Creates a standard IMG tag, however string substitution is conducted upon the flags first.

OPTIONHTML

Description:

Creates a standard OPTION tag, however string substitution is conducted upon the flags first.

AHTML

Description:

Creates a standard A tag, however string substitution is conducted upon the flags first.

SBFORMContainerALL

Description:

Creates a form that submits to another SteelBlue page. The CHECK and ACTION sections of the calling page are first processed before the HTML section of the destination page (given in SCREEN) is executed.

If an SBFORM container is placed in a CHECK or ACTION section, the contents of the SBFORM are only executed if the associated SBFORM (with the same NAME) was submitted in the HTML section.

Values in the $this namespace in the CHECK, ACTION, and destination HTML section can be set using the CLICK and SET flags. The CLICK flag sets $this{click} with the given value. The SET flag supplies a set of tag and value pairs in the form "tag1=value1;tag2=value2;...". This results in $this{tag1} being set to "value1", $this{tag2} being set to "value2" and so on. Note that SET and CLICK options are implemented in the URL, and therefore can be changed by the user.

If SBURL is specified, is contents is evaluated as an Eval expression and the result used as the URL to the SteelBlue executable. This can be used to switch between secure and insecure copies of the site for example. To promote ease of code transportability, it is strongly encouraged that possible values for SBURL are stored in the configuration file and retrieved by a call to getConfig().

Usage:

<SBFORM SCREEN=filename NAME=name
        [SBURL=eval_exp]
        [CLICK=value]
        [SET="tag1=value1;tag2=value2;..."]>
  Form elements
</SBFORM>
SCREEN-Destination SteelBlue filename (relative to BasePages) of the form (required in HTML section)
NAME-Name of form
SBURL-Eval expression specifying an alternate SB executable URL
CLICK-Value to be set to $this{click}
SET-Pairs of tags and values to be set in the this namespace

Example:

<HTML>
 <BODY>
  <SBFORM name="myform" screen="welcome.sb">
   <input name="editbox"><br>
   <input type="submit">
  </SBFORM>
  <SBREF screen="welcome.sb">Back to welcome</SBREF>
 </BODY>
</HTML>

<CHECK>
 <!-- This error only appears if the form is submitted -->
 <SBFORM name="myform">
  <error text="You entered $this{editbox}">
 </SBFORM>
</CHECK>

See Also: REDIRECT


REPLACEHTML

Description:

Evaluates a string either through variable substitution or Eval interpretation and prints the result.

If no other flags are given, the VALUE flag is passed through variable substitution and the result is printed. If VALUE is empty, the ELSE flag is printed.

If BOOL is given, the BOOL flag is passed through Eval interpretation. If the result is true (i.e. other than "0"), the VALUE flag is printed, otherwise the ELSE flag is printed.

IF EVAL is given, the contents of VALUE and ELSE are passed through Eval interpretation instead of string substitution before printing.

Usage:

<REPLACE VALUE="string"
         [ELSE="string" [BOOL="Eval Boolean"]]
         [EVAL]>
VALUE-String to be interpreted and displayed
ELSE-String to be displayed if BOOL evaluates to false or VALUE is empty and BOOL not specified
BOOL-If true, VALUE is displayed, else ELSE is displayed
EVAL-If given, VALUE and ELSE are passed through Eval interpretation

Example:

The following prints 23 + 2 = 25:
<assign name="$people{count}" value="23">
<replace value="$people{count} + 2"> =
<replace value="$people{count} + 2" EVAL>

See Also: DECLARE ASSIGN


FRAMEHTML

Description:

Creates a frame tag for either a standard URL or a SteelBlue page.

If SRC is used, a standard URL is used as the frame destination. If SCREEN is used, a SteelBlue page is used as the destination.

If SCREEN is used, values in the $this namespace in the destination HTML section can be set using the CLICK and SET flags. The CLICK flag sets $this{click} with the given value. The SET flag supplies a set of tag and value pairs in the form "tag1=value1;tag2=value2;...". This results in $this{tag1} being set to "value1", $this{tag2} being set to "value2" and so on.

If SBURL is specified, is contents is evaluated as an Eval expression and the result used as the URL to the SteelBlue executable. This can be used to switch between secure and insecure copies of the site for example. To promote ease of code transportability, it is strongly encouraged that possible values for SBURL are stored in the configuration file and retrieved by a call to getConfig().

Please note that the CHECK and ACTION section is executed once for every FRAME tag with a SCREEN flag.

Usage:

<FRAME (SRC="url" | SCREEN="filename")
        [SBURL=eval_exp]
        [CLICK=value]
        [SET="tag1=value1;tag2=value2;..."]>
SCREEN-SteelBlue filename (relative to BasePages) for the frame
SRC- URL for the frame
SBURL-Eval expression specifying an alternate SB executable URL
CLICK-Value to be set to $this{click}
SET-Pairs of tags and values to be set in the this namespace

Example:

<HTML>
 <FRAMESET rows="50%,50%">
  <FRAME SRC="http://www.tcg-inc.com/">
  <FRAME SCREEN="welcome.sb">
 </FRAMESET>
</HTML>

REDIRECTCHECK, ACTION

Description:

Changes the destination SteelBlue page from one given in an SBFORM or SBREF tag.

Usage:

<REDIRECT SCREEN="filename">
SCREEN-Destination SteelBlue filename (relative to BasePages)

Example:

<HTML>
 <BODY>
  <SBREF SCREEN="somewhere">
   Go somewhere
  </SBREF>
 </BODY>
</HTML>
 
<ACTION>
 <!-- redirect destination to the welcome page -->
 <redirect screen="welcome.sb">
</ACTION>

See Also: SBREF SBFORM


ERRORCHECK, ACTION

Description:

Causes the previous HTML page to be redisplayed with the given error message. If an ERROR flag is in the CHECK section, the rest of the CHECK section is executed (but not the ACTION section) and then the HTML section is redisplayed. If an ERROR flag is in the ACTION section, the rest of the ACTION section is executed and then the HTML section is redisplayed. Input boxes in the HTML section are automatically restored for the SBFORM that was submitted. Additional ERROR flags will cause a list of errors to be displayed.

Usage:

<ERROR TEXT="string">
TEXT-Text to appear in the error message

Example:

<HTML>
 <BODY>
  <showerrors>
  <sbref screen="welcome.sb">
    Press to make an error
  </sbref>
 </BODY>
</HTML>
<CHECK>
 <ERROR text="This is an error">
 <ERROR text="This is another error">
</CHECK>

See Also: SHOWERRORS


CONTENTHTML (MIME)

Description:

Creates alternative MIME type files. If a screen name ends with ".mime", a special MIME mode is used to allow the creation of text or binary pages with a different content type. The CONTENT tag is used to define the content type of the resulting page. The CONTENT tag should be used only once, and should occur before any print() or REPLACE statements.

Please see the section Other MIME Types for more information.

Usage:

<CONTENT TYPE="string">
TYPE-The content type of the file

Example:

<!-- In a file named test.mime -->
<HTML>
 <CONTENT TYPE="text/plain">
 <REPLACE VALUE="HI!\nThis is a plain test file">
</HTML>