Zot-Dispatch 2.0| Next: Templates

Zot-Dispatch: ZD-Method


The cornerstone of tailoring Zot-Dispatch to meet your needs is the hidden input element. Hidden input elements in HTML forms do not appear to the user viewing a form. They have preset names and values when the document is first retrieved. Using hidden input fields in conjunction with Zot-Dispatch gives you great flexibility in controlling Zot-Dispatch's behavior.

The most important hidden input element for Zot-Dispatch has the name ZD-Method. Each separate ZD-Method hidden element in a form specifies a single action that is to be performed by Zot-Dispatch. There are three fields within a ZD-Method hidden element that help to specify exactly what ZD is to do.

The three fields are:

and they are specified in the order shown above separated by semi-colons as follows:
    <INPUT TYPE=hidden NAME=ZD-Method
      VALUE="Dispatch Method;Destination;Template">

Dispatch Method

The Dispatch Method field of a ZD-Method hidden input element specifies one of the three dispatch methods (mail, append, or reflect). The term ZD-Mail is used in this field to have Zot-Dispatch send e-mail, ZD-Append is used in this field to have Zot-Dispatch append to a file, and ZD-Reflect is used to have Zot-Dispatch reflect (echo data to the user's browser).
    Examples:
      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Mail;Destination;Template">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Append;Destination;Template">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Reflect;Destination;Template">
With each of the dispatch methods Zot-Dispatch will mail, append, or reflect either the default output (name=value pairs) or will output your template with the appropriate values substituted (More on templates later).

Destination

The destination field will contain different types of information based on what dispatch method is specified in the Dispatch Method field.

ZD-Mail
If the Dispatch Method field is ZD-Mail, then the Destination field is the e-mail address (or comma separated list of addresses) to which the response data is sent.

    Examples:
      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Mail;lmegliol@uci.edu;Template">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Mail;lmegliol@uci.edu, lmegliol@hydra.acs.uci.edu;Template">

ZD-Append
When the Dispatch Method field is ZD-Append, then the Destination field must be the location of a single file to which the data should be appended (The path is relative to the Document Root that is set in the configuration file, see Doc Root and User Dir). The file named should have file permissions set appropriately such that Zot-Dispatch (the server) can write to it.

    Examples:
      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Append;/indiv/lmegliol/append.file;Template">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Append;~lmegliol/append.file;Template">
In the first example, the response data would be appended to the file /indiv/lmegliol/public_html/append.file relative to the directory set as the Document Root (In this case the Document Root is set to /Web/doc so the full path to the file is /Web/doc/indiv/lmegliol/public_html/append.file), and in the second example, the response data would be appended to the file ~lmegliol/append.file (This file is translated the same as is done in the NCSA httpd server, see Doc Root and User Dir).

ZD-Reflect
If the Dispatch Method field of ZD-Method is ZD-Reflect then the Destination field will not contain the destination of the response (since it will always be the user's client), but rather it will be information regarding the form in which the response is returned to the client. These topics are best left until the basics of ZD-Method are fully understood.

A more in depth discussion of the Destination field with regards to ZD-Reflect is presented in the section Zot-Dispatch: More on ZD-Reflect.


Template

The Template field of a ZD-Method hidden element specifies the format in which the response data should be dispatched. The default is for Zot-Dispatch to return the default response (a listing of name=value pairs). Otherwise, a template (plain text marked up so that into it input values can be substituted) can be specified.

The details of writing a template are discussed in the section entitiled Zot-Dispatch: Templates which you can read now if desired, but isn't necessary until later.

A template is specified currently in one of three ways:

Inline (body:)
If the template is to be entered inline in the HTML of the form, the Template field must contain body: followed by the text of the template.
    Examples:
      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Mail;lmegliol@uci.edu;body:This is a template.">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Append;~lmegliol/append.file;body:This is another simple template.">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Reflect;;body:This template data will go to the client.">
In a File (file:)
If the template is to be stored in a file that is accessible (through the file system, relative to Doc Root) by Zot-Dispatch, then the Template field must contain file: followed by the name of the file in which the template is contained (The path is relative to the Doc Root or is a User Dir).
    Examples:
      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Mail;lmegliol@uci.edu;file:/indiv/lmegliol/template">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Append;../append.file;file:~lmegliol/template-file">
URL (http:)
If the template is to be retrieved via HTTP over the World Wide Web, the Template field must simply contain the URL (http URLs only) of the document containing the template.
    Examples:
      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Mail;lmegliol@uci.edu;http://www.oac.uci.edu/indiv/lmegliol/template">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Append;~lmegliol/append.file;http://www.oac.uci.edu/indiv/lmegliol/template">

      <INPUT TYPE=hidden NAME=ZD-Method
        VALUE="ZD-Reflect;;http://www.oac.uci.edu/indiv/lmegliol/template">
For each of these examples, Zot-Dispatch will retrieve the document, and use its contents as the template.

Note:When the Dispatch Method field is ZD-Reflect there are some other possible values that can be contained within the template field. These other values are related to the values of the destination field that have not yet been discussed. These topics will be discussed later in the documentation.


Examples

Enough information has now been given for you to begin writing forms that use Zot-Dispatch of your own, but before you begin we'll present some examples that bring all of these basic Zot-Dispatch ideas together.

Example 1
This first example of a form simply allows the user to input some text, and when submitted, it reflects the default response to the user.

  <FORM METHOD=POST ACTION="http://www.oac.uci.edu/cgi-bin/zd-2.0.cgi">
    <INPUT TYPE=hidden NAME=ZD-Method VALUE="ZD-Reflect;;">
    Enter some text: <INPUT TYPE=text NAME="input">
    <INPUT TYPE=submit VALUE="Submit Text">
  </FORM>
The form will appear to the user as:
Enter some text:
Go ahead and try it, but use the "Back" command to return to this page if your browser has one.

Example 2
This second example will append text you enter to a file only. Nothing will be returned to the client so use the "Back" command on your browser to return to this point if you have one.

  <FORM METHOD=POST ACTION="http://www.oac.uci.edu/cgi-bin/zd-2.0.cgi">
    <INPUT TYPE=hidden NAME=ZD-Method VALUE="ZD-Append;/X/W6/zd/2.0/ZD-2.0-Example2.append;">
    Enter some text: <INPUT TYPE=text NAME="input" MAXLENGTH=80>
    <INPUT TYPE=submit VALUE="Submit Text">
  </FORM>
This form will appear to the user as:
Enter some text:
Go ahead and try it. After you come back, take a look at the file to which the data was appended.

Example 3
This third example shows how more than one ZD-Method hidden element can be put in a form in order to do more things at once.

  <FORM METHOD=POST ACTION="http://www.oac.uci.edu/cgi-bin/zd-2.0.cgi">
    <INPUT TYPE=hidden NAME="ZD-Method" VALUE="ZD-Append;/X/W6/zd/2.0/ZD-2.0-Example2.append;">
    <INPUT TYPE=hidden NAME="ZD-Method" VALUE="ZD-Reflect;;">
    Enter some text: <INPUT TYPE=text NAME="input" MAXLENGTH=80>
    <INPUT TYPE=submit VALUE="Submit Text">
  </FORM>
This form will appear to the user as:
Enter some text:
Go ahead and try it. This form will append to the same file as the previous example, only this time the data that is appended will also be reflected to the user's client. Take a look at the file to which the data was appended.
This concludes the very basics of Zot-Dispatch. With the knowledge gained from this document you should be able to create very simple forms.

If you have not yet read the document on writing templates, we suggest you do that now. Otherwise, go on to learn about substitution within the ZD-Method element.


Zot-Dispatch 2.0| Next: Templates
Zot-Dispatch 2.0
Written by Leonard Megliola III (lmegliol@uci.edu)
Last Revised 02 January 1996