Steps for Creating the Initial Sample Search FORM
The first step in making the jump from Web Page to Database table is to create a FORM which assembles a query that the database will understand. Once all the parts necessary to form a query are assembled they can be sent to the database via the CGI (the Common Gateway Interface) where the database can disassemble the form information and perform the search.
Thus:
Step 1: Find out what the database requires to perform a search and provide it.
- Most databases require these mimimum inputs
- Name of the database
- The fields to include when returning results (the SQL SELECT statement)
- Filemaker asks for the name of a layout
- A layout contains all or some of the fields in the database
- This tells the database it can ignore the other fields for this search
- The name of the format file where the results should be returned
- You want to customize how the results look don't you?
- We will create a file called results.htm
- A submit button is required to perform the search.
- Additionally, you might include other options in the search
- A field to sort the results by
- An operator for the field(s) you are searching (begins with, less than, contains, etc.)
- The number of records to return to a page at once.
Step 2: Add some HTML FORM elements so that a user can input a search term or terms.
- These can be hand-typed or input via a front end like Home Page
- Input elements can be pull-downs or input fields or buttons
- First example is providing a small field for a Gene name
- The FORM elements are ONLY data-holding elements with NO relation to the database
- You need to follow the rules of the particular application you are using to get the data from your FORM to the database. Often this is done by naming the FORM element the same name as the field name in the database. Other times you may have to make the declaration more complete (FORM{lastname}='LAST').
- Filemaker assumes that the name you give the FORM input element is the field name it will be processing.
Stop here to create the first file using the drag and drop features of Claris Home Page to create the form. This is a file we will name "search.htm"
- Open the Filemaker Form Library (PC - Under the View Menu./ Mac - under Windows)
- Go to "-Required tags" and drag the "Filemaker Form" tag and associated elements to a new blank Claris Home page file.
- Each element can be double-clicked and you will need to provide the required information.
- -Db is example.fp3
- -Lay is "Single Record"
- -Format is "results.htm"
- -Error is "errors.htm"
- For readability add carriage returns after each element by hitting Enter.
- Scroll down in the "-Requred Tags" window and drag a "-Find" button to your document. Make sure to place it within the boundaries of the FORM (marked by a pale red rectangle).
- Open the Forms Palette from the View (PC) OR Window (MAC) Menu. A small toolbar of different Form elements appears. This first form will contain a simple input field. The icon is a small white rectangle with "ab" in it.
- Place your cursor above or to the left of the "-Find" button in your document and this click this icon. A field will be inserted in your document. Don't worry if you don't place it exactly where you want it. It can be dragged later.
- The object editor for that form element will appear. If not, you can double-click it any time. Type the word "Gene" for the Name and set the size to 6.
- Save the file as "search.htm" If Home Page asks you to provide a title first, type "My Search Page."
Stop here and review the HTML FORM code with the instructor. Then continue to create the results file.