Session Field Library
The Session Field Library is a very nice add-on to Session Mode. It allows you to display forms on the screen using Session Variables (variables that maintain their values between pages). Although such tasks are quite common and have long been handled by CGI Scripting Languages, heitml's Session Field Library handles these tasks in an intuitive manner, by using Tags that retain the familiar HTML syntax you have come to know so well.
The following example is taken from one of our own Demonstration pages that allow the User to select font size and text color to suit his own tastes. There are two Session Variables in this example: textcolor and textsize. Their values can be carried forward to all pages in a Web Site, thus giving the User a measure of control over what he sees. Values are assigned to these variables from within a form, using the <sessionFI> (session field input) Tag:
Each call to the <sessionFi> Tag creates a form field for the variable named in quotes as seen above. The <sessionButton> Tag creates a button to submit the form for processing. This is all you need to do. Once the user has entered something into the form and submitted it, the Session Variables textcolor and textsize automatically receive the desired values.
How it works
The Session Field Library actually performs two tasks:
< sessionForm href=SrvLocalUrl > ... </sessionForm>
This is an Environment Tag (a Tag that requires an End Tag). It creates a form, the individual fields of which should contain Session Fields. The href parameter can specify a URL to be called when the User clicks on the Submit Button. If not specified, href defaults to the current page.
It is not required to use <sessionForm>. Any normal HTML-form may contain Session Fields, so long as they contain the <sessionHidden> Tag, which activates Session Mode (a necessary prerequisite to maintain the current state of variables across pages). Since <sessionForm> takes care of this chore for you, it reduces your workload.
< sessionFi name size maxlength=size type="s" />
This Tag defines a Session Field. The name parameter specifies the name of the string variable to which the data will be assigned. (e.g. For a Session Variable named se.textcolor you write name="textcolor"). The size parameter specifies the number of characters that will fit inside the form display field. Maxlength is the maximum number of characters that can be assigned to the variable. You need only specify this parameter if the form display field is smaller than the number of characters that can be assigned to the variable. In this case the field content can be scrolled left and right to view the excess data.
The type parameter can be "s" for string, "t" for a string that is trimmed of blank spaces after having been read in from the form field, "i" for integer, "r" for real, and "b" for Boolean. Data is converted to the type specified after it has been read in from the form (i.e. after the User submits the form for processing. If a data type conversion is not successful, the null value is assigned.
< sessionCheckBox name />
The name parameter denotes a Session Variable of type Boolean. A checkbox is displayed in the Browser window. A box with a check in it represents the Boolean value "true", and an empty checkbox stands for "false".
< sessionTextArea name rows=10 cols=10 wrap="physical" />
Displays the Session Variable in a text area field. The rows, cols and wrap parameters have the same meaning as with the HTML <textarea> Tag.
< sessionButton name value=name />
Defines a Submit Button of a given name. This Tag is a mere abbreviation of the HTML submit button Tag. The value parameter represents the label of the button and, if not specified, defaults to the first argument. If the button is pressed and a new page called, the variable ff.name, where name is the name of the button, gets the value given by the second parameter value.
© 1996-2022 H.E.I. All Rights Reserved.