End User Recipe: Employee Search


Search applications have two key parts: an entry form and a results page. Typically the entry form uses little or no server-side code; its sole function is to accept the search criteria and pass the values to the results page where the search operation is actually performed. Our first recipe describes how to create just such an entry form page.

Step 1: Implement Employee Search Design

To start, create the basic page with the search criteria form.

1.

Create a basic dynamic page, either by hand or derived from a template.

In the EmployeeLookup folder, locate the folder for your server model and open the employee_search page found there.

2.

Add a table to the content region of your page to contain the interface elements for the application.

From the Snippets panel, drag the Recipes > EmployeeLookup > Wireframes > Employee Search - Wireframe snippet into the Content editable region.

3.

Within the table, insert the form and necessary form elements for the user login. You'll need a single text field to hold the keywords, and a submit button.

Place your cursor in the row below the words EMPLOYEE SEARCH and insert the Recipes > EmployeeLookup > Forms > Employee Search - Form snippet [r2-1].

r2-1.


4.

Save the page before continuing.

Most examples of single-field search applications target a specific data source field, such as Last Name. Our application is capable of searching across several fields using AND or OR operators; the code that makes this possible is inserted into the search results page. The simple search form also includes a link to an advanced search function.

Step 2: Specify Form Action and Method

The <form> tag on a search page contains both the destination and the means for transmitting the search criteria. Both attributes can be set through Dreamweaver's Property inspector.

1.

Place your cursor anywhere within the form in either Design or Code view.

2.

From the Tag Selector, select the <form> tag.

3.

On the Property inspector, enter the path to the search results page.

Select the folder icon next to the Action field and choose the employee_results file for your server model.

4.

Make sure the Method is set to GET rather than POST or Default.

Here, we're using GETwhich relies on URL arguments to pass parametersto properly navigate the recordset. The navigation functions, found in other pages of this application, read the passed parameters from the URL and filter the recordset appropriately.

5.

Select the phrase advanced search and use the Link field in the Property inspector to create a link to the employee_search_advanced file for your server model.

6.

Save the page.

You'll note that no data validation is applied here; we're not even making an entry into the required search field. Why? In this situation, we want to allow for a return of all the records, and a blank search field indicates a wide-open filter.




Macromedia Dreamweaver 8 Recipes
Macromedia Dreamweaver 8 Recipes
ISBN: 0321393910
EAN: 2147483647
Year: 2003
Pages: 121

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net