Previous: Date and Time| Zot-Dispatch 2.0| Next: ZD-Version

Zot-Dispatch: ZD-Method Substitution


So far you have been shown how to configure Zot-Dispatch by placing the values of the three ZD-Method fields (Dispatch Method, Destination, and Template) directly into the VALUE of a ZD-Method input element. There may be situations, however, where you don't/can't place the value(s) of one/more of these fields directly into the ZD-Method element itself. Zot-Dispatch allows you to define the values of these fields in other input elements which can be substituted into ZD-Method when Zot-Dispatch runs.

Here are a couple example situations where this might be useful:

A:You'd like to have your form e-mail a copy of the response to the user of the form, only the user's e-mail address has to be input first. Here, the value that the user enters can be substituted into the Destination field of the ZD-Method input element.

B:You have a form that allows the user to select which format the results are returned. In order to do this, the value of the Template field would have to be selectable using radio buttons or checkboxes. The value selected would then have to be substituted into the Template field of the ZD-Method input element.

The solution is simple. At any point within any of the three fields, if you'd like to have the value of another input element substituted into the ZD-Method input element, place the name of that element preceded by a dollar sign ($) and followed by a pound sign (#) as in template substitution.

For scenario A above, the HTML for the solution might look like:

  <INPUT TYPE=text NAME="e-mail-address">
  <INPUT TYPE=hidden NAME=ZD-Method VALUE="ZD-Mail;$e-mail-address#;">
Here, the e-mail address that the user enters into e-mail-address is substituted into the Destination field of ZD-Method so that the e-mail may be sent to the user. Try it out below, you should receive an e-mail with the default e-mail response contained within.
Enter Your E-Mail Address:

For scenario B above, the HTML for the solution might look like:

  <INPUT TYPE=radio NAME=template VALUE="file:/dir1/dir2/template.1">
  <INPUT TYPE=radio NAME=template VALUE="file:/dir1/dir3/template.2">
  <INPUT TYPE=hidden NAME=ZD-Method VALUE="ZD-Reflect;;$template#">
Here, the Template field value will depend on which of the radio buttons the user selects. The value of the one selected will be substituted into the ZD-Method hidden element. Here is an example, try it twice, once for each template.
Select a template:
Template 1 Template 2

Specific ZD-Method Substitution Details

The above discussion presents the basic idea behind ZD-Method Substitution. Following are some specific details regarding ZD-Method Substitution.

Undefined Values
Just as with input elements that are substituted into templates, if there is no value for an input element that is to be substituted into a ZD-Method element, the name of the element that should have been substituted will remain with the pound (#) and dollar ($) signs removed.

Multiple Values
There are two different ways that Zot-Dispatch handles multiple values when substituting values into the three fields of ZD-Method elements. The method described in the following paragraph always applies to the Dispatch Method and Template fields, and also applies to the Destination field when the Dispatch Method is not ZD-Mail. (See below for those rules)

If there are two or more input elements with the same name that should be substituted into the fields, only the last value submitted will be used. This is essentially the same way that this is handled with templates.

Multiple Values in Destination Field when using ZD-Mail

In this version of Zot-Dispatch, there are two separate ways that the Destination field is handled when the Dispatch Method is ZD-Mail. If the reference to a value to be substituted is alone in the Destination field (with no other characters) then all of the values will be used, but if any other character is in the Destination field (even a single space) only the last value of the element will be used.

For example, if I have defined two e-mail addresses in two input elements as follows:

    <INPUT TYPE=hidden NAME="e-mail" VALUE="juser@uci.edu">
    <INPUT TYPE=hidden NAME="e-mail" VALUE="lmegliol">
and I have the following ZD-Method, both addresses would get the e-mail because there are no other characters in the Destination field:
    <INPUT TYPE="ZD-Method" VALUE="ZD-Mail;$e-mail#;">
If, however, I had this ZD-Method:
    <INPUT TYPE="ZD-Method" VALUE="ZD-Mail;$e-mail#@uci.edu;">
then since there are other characters in the Destination field only the last value will be substituted. This e-mail will get sent to lmegliol@uci.edu.

Dollar Signs
If you need to put any literal dollar signs into your ZD-Method that are not part of a reference to a value to be substituted, you must place two consecutive dollar signs ($$) instead. Zot-Dispatch will replace the two dollar signs with a single dollar sign after it has completed the substitutions. This is the same as with templates.


Previous: Date and Time| Zot-Dispatch 2.0| Next: ZD-Version
Zot-Dispatch 2.0
Written by Leonard Megliola III (lmegliol@uci.edu)
Last Revised 02 January 1996