Accessibility
 
Home > Products > UltraDev > Support > Building Common Applications
Dreamweaver UltraDev Icon Macromedia Dreamweaver UltraDev Support Center - Building Common Applications
Obtaining the search parameter from the user

The search words entered by the user must correspond to values in a column in your database. For example, if your database has a column of department names, then you can let users specify a department name as their search word, or "search parameter."

You obtain the user's search parameter by adding an HMTL form to a Web page. The user specifies the parameter's value in the HTML form, then clicks the Submit button to send the parameter to the server, where another page uses it to search the database for values that meet the search condition.

Here's an example of a search page that uses a single search parameter:

The search parameter can be any type of information—area codes, months, employee names, part numbers—so long as your database contains a column with similar values.

To build a page that gets a search parameter from users:

1 In UltraDev's Document window, choose File > New File to create a new page or open a predesigned search page.
2 Choose Insert > Form to insert an HTML form on the page.
UltraDev adds an empty form to the page. You may need to turn on Invisible Elements (choose View > Visual Aids > Invisible Elements) to see the form's boundaries, which are represented by thin red lines.
3 Add a text field (Insert > Form Objects > Text Field ) or a list/menu object (Insert > Form Objects > List/Menu) to the form.
The form object you choose depends on your search parameter. If the search parameter can have more than about a dozen values, use a text field. For example, online bookstores often use a text field to let users search for a book.
If the search parameter can have less than about a dozen possible values, use a list/menu. A list/menu lets the user select the search parameter from a list of parameters that you define.
4 Choose Insert > Form Objects > Button to add a Submit button to the form
When clicked, the Submit button sends the search parameter to the server for processing.
5 You can change the label of the Submit button by selecting the button, opening the Property inspector (Window > Properties), and entering a new value in the Label textbox.
This example shows the Property inspector of a button labeled "search":
Next, you'll specify where the form will send the search parameter when the user clicks the Submit button.
6 Select the form by selecting the <form> tag in the tag selector at the bottom of the Document window.
7 In the Action text box on the form's Property inspector, enter the name of the results page that will conduct the database search.
In the following example, the results page is called getresults.jsp:
8 In the Method pop-up menu on the form's Property inspector, choose GET or POST .
The GET and POST methods offer different ways to send form data to the server. If you choose the POST method, the search parameter is sent in the body of the message. If you choose the GET method, the parameter is appended to the page's URL as a query string.
If you plan to use record navigation server behaviors on your results page (for example, if you plan to display multiple pages of results), choose the GET method. This ensures that your results page is compatible with both the search page and the record navigation server behaviors, which also rely on URL query strings to function properly.
9 Use the Dreamweaver design tools to customize the search page to your liking.
The next step is to build the results page. The results page, not the search page, is responsible for searching the database, retrieving the records found, and building a recordset with them. All these tasks can be performed by defining a filtered recordset for the results page.

To Table of Contents Forward to next document