Chapter 4: Basic Commands


WEB·FM supports eight commands for acting on a FileMaker Pro database. These commands closely mirror the tasks available in FileMaker Pro. INPUT variables allow further control over command behavior, influencing how WEB·FM interfaces with a target database. A client browser submits the contents of a FORM (or Link) along with a command and variables to an origin web server. The server passes the request to WEB·FM which acts accordingly on the target database based on the command and variables present.

Commands are normally specified in a FORM using the NAME attribute of an INPUT element as shown here:

<INPUT TYPE="submit" NAME="Find" VALUE="Submit">

Commands may alternatively be specified as part of a FORM action following the database name and "$" character.

<FORM METHOD="POST" ACTION="Database+Name.fm$Find">

In the case of a hypertext link, commands may be specified after the database name and "$" character, or in the name/value string portion of the request URL.

<A href="database+name.fm$Find?sort=date">
or
<A href="database+name.fm?sort=date&find=">

If you omit the NAME attribute from the submit button, or for whatever reason a command is not specified or received by WEB·FM, then by default the command is assumed to be Find. You can change this default command setting globally by using the Admin database and selecting an alternate default command.

Command syntax for using a graphic as a Submit button on a form is as follows:

<INPUT TYPE="image" NAME="Find" SRC="submit.gif">

Find
Find is equivalent to selecting Find from the Mode menu in FileMaker Pro and performing a Find for entered query values. There is no limit on the number of fields which can be searched. Find returns a list of found records to the web browser matching the search criteria with a header and footer, or an error page if no records are found.

FindUser
FindUser is a very powerful command. There is no equivalent in FileMaker Pro. It is perhaps analogous to performing a Find in FileMaker Pro based on the System setting for current User Name. It supports most Find command features, but with record-level user authentication requirements using the username and password values (or HTTP cookie value with name "cookie") from the client browser. This means users can flexibly Find and modify their own, and optionally only their own, database records. A cookie value may be used in place or absence of a valid password when finding or updating database records. This command requires an indexed "username" and "password", or "cookie" database field. It can be used very nicely to retrieve an update form when the user knows the correct username and password for a specific record. It is most useful with ecommerce and membership directories where each member needs to find and modify their own individual record information.

FindAll
This command works exactly the same way as the Find All command in FileMaker Pro, finding every record in the target database. FindAll will optionally return a database value list containing only unique database records.

Retrieve
This command is similar to Find. It differs from Find in that by default, no "header" or "footer" is returned. Where Find is meant to return a group or "hit list" of records from a search FORM, Retrieve is typically used in a Link to get a single specific detail record of information via a Template file.

Add
Add is equivalent to selecting New Record from the Mode menu in FileMaker Pro and entering new values or data into field cells. Within FileMaker Pro, the user can select from pop-up menus, pop-up lists, check boxes or radio buttons. The same is true with a web browser interface via WEB·FM. Just as it doesn't matter which order you enter information into the fields inside FileMaker Pro, it doesn't matter in which order you enter information from the web form.

Update
This command edits a single found record with submitted FORM data. Similar to the FindUser command, it uses the submitted field/value variables (if any), or the username and password values (or "cookie"), in an attempt to find the correct record to update. It then compares the browser username and password (or "cookie" value) against the username and password database fields (or "cookie" field) in order to validate authorization to perform an update. If more than one record is found, or no exact matches are found, or the password supplied is not valid, then access is denied and the user is prompted to supply a valid password before trying again.

Delete
Delete is equivalent to selecting Delete Record from the Mode menu in FileMaker Pro. It works the same way as Update. However, it will delete the found record rather then edit it, and the HTML page is built prior to the record being deleted.

Random
This command has no direct equivalent in FileMaker Pro. It's default behavior is to Find a random record. The Field and Value variables may be used to find a random record from those matching some specific criteria.
As you can see, the same basic tasks you use within a normal FileMaker Pro database Ñ browse records, create records and edit records Ñ are available with a web browser interface by using WEB·FM.