decorative banner

Creating query result pages


    A sample page that provides a query or search feature and displays query results on the same page.
    A sample page that provides a query or search feature and displays query results on the same page.

    One of the most common pages you'll create for viewers to your site is a page that lets viewers search a dynamic content database. For example, a page on a company intranet site might let you search a department's active projects and display the search results on the same page. This section assumes you already have a site created, open, and configured as a dynamic content site (see Making a Web site dynamic). Open a blank page in the site, make it dynamic (see Adding dynamic content and behavior), add a content source to the page (see Understanding content sources), and then proceed as follows. For this example, you'll do the following:

    • Create two forms on the same page.
    • Modify a content source.
    • Create a text input area.
    • Create a Submit button.
    • Make a dynamic content table.
    • Make an Edit button that takes you to a page displaying the details for the selected project.

    The first area of the page is a search area that lets a viewer search through a database.

To create the search area of the page:

  1. Drag the Form object from the Forms set of the Objects palette to the Layout Editor.
  2. Open the head section of the document window, and select the Content Source object.
  3. In the Filters area of the Content Source Inspector, select the field you want viewers to search by, and enter the following in the filter entry box: like '%{Request.QueryString("keyword")}%'
  4. For PHP, enter like '%{pageParameter("keyword","")}%'

    For JSP, enter like '%{gl.pageParameter("keyword","")}%'

  5. Drag the Text Input object from the Forms set in the Objects palette.
  6. In the Text Input Inspector, give the text input the name keyword and the value <%=Request.QueryString("keyword")%>
  7. For PHP, enter <?php echo pageParameter("keyword","")?>

    For JSP, enter <%=gl.pageParameter("keyword","")%>

  8. Drag the Submit Button object from the Forms set of the Objects palette to the right of the text input field.

To create the results area of the search page:

  1. Drag the Form object from the Forms set of the Objects palette to the Layout Editor, just below the first form.
  2. Drag the Repeat Rows object from the Dynamic Content set of the Objects palette to the second form you just created.
  3. On the Dynamic Bindings palette, click Bind To, and select your content source from the Content Source pop-up menu.
  4. Enter any desired labels and placeholder values for each cell in the table.
  5. Bind each placeholder to the desired fields in your content source.
  6. You might want the viewer to be able to edit a record that appeared in the search results area of the page. Here's a simple way to provide that functionality.

To create an Edit button:

  1. Add a cell to the right of the last cell in the table you created in the second form area.
  2. Type the word EDIT in the cell, and select it.
  3. In the Text Inspector, link the text to your details page (if you don't have one, just add a blank dynamic page to your site.
  4. In the Dynamic Bindings palette, set the Show Details of Current Record link action.
  5. Although designing a query or search page requires some server scripting and knowledge of SQL, the search page described here gives you a simple prototype that you can use and modify for your own site.