Chapter 5: INPUT Variables


WEB·FM supports a variety of user-selectable variables for customizing the behavior of a database transaction. Some of these variables are required when using a specific WEB·FM command. Other variables are optional or may have a default value when one is not submitted as specified in the Admin database.

Variables may be specified on either a fill-out FORM or in the URL of a hypertext link. When in a FORM, the variable field may be hidden or specified as a checkbox, radio button, or select menu. When specified in the URL of a hypertext link, variables should go after the "?" character in the URL as a string of name=value field pairs with "&" delimiters.

Header
Header specifies a database field to return with header HTML displayed above a found record or list of found records. The header variable may be used with any command. If you are using the Find or FindAll command, and you have placed a "header" field in your database, WEB·FM automatically returns the "header" database field. If no "header" field exists, then the global header HTML in the Admin database is returned.

Example:

<INPUT TYPE="hidden" NAME="header" VALUE="header">

Footer
Footer specifies a database field with HTML to return at the bottom of a found record or list of found records. May be used with any command. If you are using the Find or FindAll command, WEB·FM automatically returns the "footer" database field.

Example:

<INPUT TYPE="hidden" NAME="footer" VALUE="footer">

Error
Error specifies a Template file or database field to return when no records are found which match the search criteria, or there is some other problem performing a database transaction. May be used with any command. When not specified, WEB·FM automatically returns the "error" database field by default.

Example:

<INPUT TYPE="hidden" NAME="error" VALUE="error.html">

HTML
HTML specifies a Template file or database field to return as the main body in a reply document. If omitted, by default WEB·FM returns the "html" database field. The VALUE of the html variable is equal to the requested Template file name in the same relative directory for the current request, or the desired database field name. Template files must end with a ".html" suffix, while database field names normally do not include a ".html" suffix but can if Template substitutions are needed. The ".html" suffix is a flag to WEB·FM to perform database field and value list substitutions as described in Chapter 7: Page Generation.

Example:

<A href='EdExpert.fm$Retrieve?RecNum=1&html=detail.html&layout=data+entry'>

Operator
Operator specifies how a database Find should "operate". If omitted from a form, the default "begins with" operator is assumed. Operator is NOT field specific but applies to all fields in the entire form. However, including comparison operators within a field's search criteria can sometimes override the global operator. In particular, the "request" option for the Operator variable allows find symbols such as "...", "=", "//", and "!" to be recognizes by FileMaker Pro. Both comparison and logical operators are available as follows:

begins with
contains
ends with
equals
greater than
greater than or equal
less than
less than or equal
not equal to
request
or For example:

<A href='EdExpert.fm?date=//...3/9/98&operator=request'>

Field
Field specifies a database field name to search on. This variable is always partnered with the Value variable which tells WEB·FM what to search for. Although normally used with the Find command so the desired search field may be user selectable, Field/Value may be used or even required with most commands in order to perform special needs. It is highly recommended for use with the Update and Delete commands to specify which record should be edited.

Example:

<SELECT NAME="field"> <OPTION>City <OPTION>State <OPTION>Country </SELECT>

Value
Value specifies a query value to search for in the database field specified by the Field variable. Field and Value are always used together, most of the time in an update FORM.

Example:

<FORM METHOD="POST" ACTION="database+name.fm">

<INPUT TYPE="hidden" NAME="field" VALUE="RecNum">

<INPUT TYPE="hidden" NAME="value" VALUE="1234">

Sort
Sort specifies a database field for sorting the found records. Two Sort variables may be used for nested sorts in a single form or Link.

Example:

<INPUT TYPE="hidden" NAME="sort" VALUE="date">

SortOrder
Specifies the direction for sorting found records. SortOrder requires the Sort variable in order to specify which database fields are to be used for sorting. SortOrder recognizes "ascending" and "descending" as valid options. However, "ascending" is WEB·FM's default behavior, so the variable is only necessary if you want to sort the records in descending order.

Example:

<INPUT TYPE="hidden" NAME="sortorder" VALUE="descending"> Max

Max allows you to limit the number of found records returned to the Web browser. The value of Max must be an integer. If this variable is omitted WEB·FM will return all found records to the client browser. For larger databases it's reasonable to disable Browse All permission in the Admin database.

Example:

<INPUT TYPE="hidden" NAME="max" VALUE="10">

Layout
Specifies a database layout name to use when performing a database request. Layout is required when dealing with ANY relational fields in any manner, and is highly recommended for use with Template files and all commands save Find or FindAll.

Example:

<A href='EdExpert.fm$Random?html=detail.html&layout=data+entry'>

T I P By creating a database layout which includes only the fields you wish to use on the Web, and then targeting that layout by using the Layout variable, you can often improve the speed of a database request.

DoScript
Use DoScript to invoke ScriptMaker scripts you have created in your FileMaker Pro database. DoScript tells WEB·FM the name of a ScriptMaker script to run and will invoke that ScriptMaker script in your database prior to returning html. Scripts should be visible in the Script menu, so select the "Include in menu" script option. The point at which WEB·FM invokes a script is as follows:

  1. Find, Edit, or Add records
  2. Invoke a ScriptMaker script
  3. Sort found records
  4. Return html

Example:

<INPUT TYPE="hidden" NAME="doscript" VALUE="sendmail">