Building the Search page

In the Search page, your Web audience can either specify their own search criteria, submit a predefined search request that you specify, or submit a search request that is a combination of their own search criteria and a predefined request that you specify.

If you want your audience to be able to specify their own search criteria, set up input elements on the Search page. If you define a search request in advance, your Web audience can just click a button to start a search. If you want to combine search criteria that is specified by your audience with search criteria that you specify, your page comprises both types of elements: CDML tags that specify your predefined search criteria, and input elements where your audience can specify their own search criteria.

To build a Search page:

  1. Create a new blank page.
  2. Choose FileMaker Form Library from the View menu (Windows) or the Window menu (Macintosh).

    The FileMaker Form library opens, listing the CDML tags logically, by action.
  3. In the SEARCH section of the library, click the Required tags entry under the Search Page entry.

    The required tags for a Search page appear on the right of the library window.

  4. Click the tag labeled FileMaker Form to highlight the entire group, then drag the selection to your Search page.
  5. In the same Required tags entry, choose at least one tag for submitting a search request. Drag one or all the tags into the FileMaker form area that contains the other required tags.

  6. Specify the attributes for each required tag in the page. Double-click the icon to display the object editor.

    For this tag

    Specify the following information

    -Db

    The filename of the database your pages refer to. This is a hidden entry.

    -Lay

    The name of the layout being accessed in the search. This is a hidden entry.

    -Format

    The filename of the page that is returned as a response to the search request a request. This is a hidden entry.

    -Error

    The filename of the page that is returned if an error occurs in processing the search request. This is a hidden entry.

    -Find

    The text on the button used in the browser to submit a search request.

    -FindAll

    The text on the button used in the browser to find all records in your database.

    -FindAny

    The text on the button used in the browser to find any (random) record in your database.

Adding fields to the Search page

You can add fields and choose the format for how they will appear in the Search page. Drag items from the Search Fields section of the Specifying search criteria entry in the FileMaker Form Library.

Note FileMaker container fields cannot be used to define a search request.

To use input elements from the FileMaker Form Library:

  1. Open the FileMaker Form Library.
  2. In the Specifying search criteria entry, choose the element you want, and drag it onto the FileMaker form area of your Search page.

    Drag this element to your page

    To use this format for the search field

    Text field

    A text field form element. See Adding a text field for more information.

    Pop-up menu

    A pop-up menu or scrolling list form element.
    Note
    Fields that you want to format as pop-up menus or scrolling lists must have values associated with them, either defined by you in Claris Home Page or defined in value lists in the FileMaker Pro database. For more information on defining values with Claris Home Page, see Adding a pop-up menu or scrolling list.

    Check box

    A check box form element.
    Note
    Fields that you want to format as check boxes must have values associated with them, either defined by you in Claris Home Page or defined in value lists in the FileMaker Pro database. For more information on defining values with Claris Home Page, see Adding a check box.

    Radio buttons

    A radio button form element.
    Note
    Fields that you want to format as radio buttons must have values associated with them, either defined by you in Claris Home Page or defined in value lists in the FileMaker Pro database. For more information on defining values with Claris Home Page, see Adding a list of radio buttons.

    Text area

    A text area form element. See Adding a text area for more information.

    Reset

    A button appearing in the browser. When clicked, this button resets all other input elements to their default values. See Adding a reset button.

  3. Double-click each form element to bring up its object editor, and then enter the field name to which it corresponds in the Name text box.
  4. Close the object editor to apply your settings.

Using value lists from the FileMaker Pro database

Some FileMaker fields in your database file might have a value list associated with them to facilitate data entry. Value lists from FileMaker can be used in your Search page.

To use FileMaker Pro value lists for check boxes and radio buttons:

  1. Open the FileMaker Form Library.
  2. In the SEARCH section of the library, select the entry for Specifying search criteria.

    The search criteria tags appear on the right of the library window.
  3. In the Search Fields section of the library, choose an HTML input type (for example, choose Check Box), and then drag the element into the FileMaker form area of the Search page.

  4. Double-click the FMP-ValueList tag to display its object editor. Type the name of the field in the Field Name text box, and then type the name of the value list in the Value List text box.
  5. Close the FMP-ValueList Tag Object Editor to apply the setting.
  6. Double-click the check box element itself to display the Check Box Object Editor.
  7. Type only the name of the field to which it corresponds in the Name text box.
  8. Close the Check Box Object Editor to apply the setting.

Tip In the browser, the elements within the FMP-ValueList tag area (denoted by the box with the red border) repeat as many times as there are values in the value list. You can format the orientation of the elements in this tag, so that multiple values appear vertically in the browser by typing a carriage return character. Press Enter (or Shift-Enter for less white space between lines) on Windows; or press Return (or Shift-Return for less white space between lines) on Macintosh, immediately following the FMP-ValueListItem tag in the FMP-ValueList area.

To use FileMaker value lists for pop-up menus:

  1. Open the FileMaker Form Library.
  2. In the SEARCH section of the library, select the entry for Specifying search criteria.

    The search criteria tags appear on the right of the library window.
  3. In the Search Fields section, drag the CDML Code tag that appears in the Pop-up Menu section into the FileMaker form area of the Search page.
  4. Double-click the CDML Code tag to edit the raw code. Without deleting quotation marks, change the words "field name here" to the field name, and then change "value list name here" to the name of the value list.
  5. Close the CDML Code Tag Object Editor to apply the setting.

Specifying search criteria

When making a search request in the FileMaker Pro database, your Web audience specifies their criteria in the fields on the Search page. Every field that is used for searching needs to have an associated rule or logic for how to search it. In addition, the entire find request must have a rule or logic for how it is processed in the FileMaker file. You can set up your Search form so that the logic for the search and fields is specified by your Web audience. You can also predefine the logic for both the fields and the search request itself, or combine logic that is specified by both you and your audience.

To set the logical operator for a search request:

  1. Open the FileMaker Form Library.
  2. In the SEARCH section of the library, select the entry for Specifying search criteria.

    The search criteria tags appear on the right of the library window.
  3. For a fixed search request, drag the -LOp (logical operator) tag into the FileMaker form area in the Search page.
  4. Double-click the -LOp tag to display its object editor.
  5. Select AND for a search request that matches records to all the submitted search criteria exactly or select OR for a search request that matches records to at least one of the submitted search criteria.
  6. Close the -LOp Object Editor to apply the change.

For a search request whose logic will be specified by the Web audience, drag the two -LOp tags denoted by radio buttons into the FileMaker form area in the Search page.

To set the field comparison operator for each field in a search request:

  1. Open the FileMaker Form Library.
  2. In the SEARCH section of the library, select the entry for Specifying search criteria.

    The search criteria tags appear on the right of the library window.
  3. For a search request where the field comparison operator is fixed, drag the -Op tag into the FileMaker form area in the Search page.

    The -Op tag should appear immediately before the field with which you associate it.

  4. Double-click the -Op tag to display its object editor.
  5. Select a field comparison operator from the list.

    Choose this field comparison operator

    To show these search results to your Web audience

    Equals

    Records that match the search criteria exactly

    Contains

    Records that contain the character or string of characters specified in the search criteria

    Begins with

    Records that feature the character or string of characters featured in the search criteria at the beginning of a value

    Ends with

    Records with the character or string of characters featured in the search criteria at the end of a value

    Greater than

    Records with values greater than the search criteria

    Greater than or equals

    Records with values greater than or exactly equal to the search criteria values

    Less than

    Records with values less than the search criteria

    Less than or equals

    Records with values less than or exactly equal to the search criteria values

    Not equals

    All Records except those that match the search criteria

  6. Close the -Op Object Editor to apply the change.

For a search request whose field comparison operators will be specified by the Web audience, drag the field comparison pop-up menu element from the Specifying search criteria section in the library into the FileMaker form area in the Search page. The field comparison operator should appear immediately before the field with which you associate it.

Setting options for sorting the search results

You can specify whether you want the results of your search to be sorted or not and whether the Web viewer initiates the sort. You can also predefine a sort order or combine a predefined sort order with choices for sort order your audience makes before submitting a search request.

To specify the field that search results are sorted by:

  1. Open the FileMaker Form Library.
  2. In the SEARCH section of the library, select the entry for Specifying sort order.

    The tags for specifying sort order appear on the right of the library window.
  3. Drag the -SortField and -SortOrder tags into the FileMaker form area of the Search page.

    The -SortField tag must appear directly before the -SortOrder tag associated with it.

  4. Double-click the -SortField tag to display its object editor, and then type the name of the sort field.
  5. Close the -SortField Object Editor to apply your change.
  6. Double-click the -SortOrder tag to display its object editor, and then choose the sort order. For a sort order based on a value list, choose Custom, and then type the name of the list in the Value List text box.
  7. Close the -SortOrder Object Editor to apply your change.

To set up sorting options specified by your Web audience:

  1. Open the FileMaker Form Library.
  2. In the SEARCH section of the library, click the entry for Specifying sort order.

    The tags for specifying sort order appear on the right of the library window.
  3. In the Sort Field section, choose the CDML Code tag and drag it into the FileMaker form area of the Search page.

    The purpose of this tag is to display a pop-up menu of all the fields in the layout you specified for the Search page. Your Web audience can choose the field to sort on from this list.
  4. In the Sort Order section, choose the sort order element that appears in the Specified by user section.

    This element is a pop-up menu with sorting values (ascending, descending) already defined.
  5. Drag the element so that it appears directly after the CDML Code tag (the sort field) in the FileMaker form area of the Search page.

Setting options for the search results

You can set the maximum number of records displayed in the Search Results Page, or you can allow your Web audience to choose a maximum from a pop-up list you add to the Search page.

To set the maximum number of records displayed in each Search Results page:

  1. Open the FileMaker Form Library.
  2. In the SEARCH section of the library, select the entry for Result set options.

    The tags for Search result options appear on the right of the library window.
  3. Drag the -Max tag into the FileMaker form area of the Search page.
  4. Double-click the -Max tag to display its object editor.
  5. Type a number for the maximum number of records you want displayed in a Search Results page.
  6. Close the -Max Object Editor to apply your change.

To allow your Web audience to determine the maximum number of records displayed in the Search Results page:

Saving the Search page

Once you have set up the fields and the options for searching and sorting, you can save and name the Search page. The name of the Search page should correspond to the filename used in all files that refer to it. For example, the Index page file named "index.htm" might refer to the Search page file called "search.htm."


Previous topic | Contents | Next topic