End User Recipe: Survey Completed

When the user has completed and submitted the survey, it's a good idea to acknowledge the user's actions and, in some cases, issue a reward. The Survey Completed page displays just such a message, which was incorporated into the record when the survey was first created. This is a simple page that takes one data field from the Surveys table filtered to show the current survey record and binds it on the page. Often, surveys incorporate some sort of incentive to encourage users to take it; the Survey Completed page is an appropriate place for such an incentive.

Step 1: Implement Survey Completed Design

For this page, all you'll need is a heading and an area to hold the message. To allow the most flexibility, the area should be a nested table or some other expandable Web element.

  1. Create a page for the Survey Manager recipe, either from a template or from the File > New dialog.

    graphics/book.gif In the SurveyBuilder folder, locate the folder for your server model and open the survey_completed page there.

  2. In the Content area of your page, create a header for the page and a general area to hold the message.

    graphics/book.gif From the Snippets panel, drag the Recipes > SurveyBuilder > Wireframes > Survey Completed Wireframe snippet into the Content editable region.

  3. In the general area, add a nested table to hold the dynamic text for the completed survey message.

    graphics/book.gif Place your cursor in the row below the words SURVEY COMPLETED and insert the Recipes > SurveyBuilder > ContentTables > Survey Completed - Content Table snippet [r5-22].


    Figure r5-22.

    graphics/07fig22.jpg


  4. Save the page.

Step 2: Add Database Components

As mentioned earlier, this page uses a data field from the Surveys table. The recordset needed is restricted: just one field from one record.

For ASP
  1. From the Bindings panel, choose Add (+) and select Recordset (Query) from the list.

  2. In the Advanced Recordset dialog, enter a name for the recordset.

    graphics/book.gif Enter CompletedSurvey in the Name field.

  3. Choose the data source.

    graphics/book.gif Select Recipes from the Connections list.

  4. In the SQL area, enter the following code:

     
     SELECT SurveyCompletedMessage FROM Surveys WHERE SurveyID = IDParam 
     
  5. In the Variable area, choose Add (+) to create a new variable.

  6. Add an appropriate name for your variable.

    graphics/book.gif Enter IDParam in the Name column.

  7. Enter a default value.

    graphics/book.gif Enter 0 in the Default Value column.

  8. Insert a run-time value.

    graphics/book.gif Enter Request("ID") into the Run-Time Value column.

  9. Click OK to close the dialog and insert the recordset.

For ColdFusion
  1. From the Bindings panel, choose Add (+) and select Recordset (Query).

  2. Switch to the advanced view of the dialog and enter an appropriate name for the recordset.

    graphics/book.gif Enter CompletedSurvey in the Name field.

  3. Choose your data source.

    graphics/book.gif Select Recipes from the Data Source list.

  4. Enter a username and password if necessary.

  5. In the SQL area, enter the following code:

     
     SELECT SurveyCompletedMessage FROM Surveys WHERE SurveyID = #URL.ID# 
     
  6. Verify your entries in the Recordset dialog and click OK to close that dialog.

For PHP
  1. From the Bindings panel, choose Add (+) and select Recordset (Query) from the list.

  2. In the Advanced Recordset dialog, enter a name for the recordset.

    graphics/book.gif Enter CompletedSurvey in the Name field.

  3. Choose the data source.

    graphics/book.gif Select Recipes from the Connections list.

  4. In the SQL area, enter the following code:

     
     SELECT SurveyCompletedMessage FROM surveys WHERE SurveyID = IDParam 
     
  5. In the Variable area, choose Add (+) to create a new variable.

  6. Add an appropriate name for your variable.

    graphics/book.gif Enter IDParam in the Name column.

  7. Enter a default value.

    graphics/book.gif Enter 0 in the Default Value column.

  8. Insert a run-time value.

    graphics/book.gif Enter $_GET["ID"] into the Run-Time Value column.

  9. Click OK to close the dialog and insert the recordset.

Step 3: Adding Dynamic Text

To complete this page, all we need to do is add the dynamic text to the page.

  1. From the Bindings panel, expand the SurveyCompleted recordset.

  2. Place the dynamic text elements in their proper place on the page.

    graphics/book.gif Drag SurveyCompletedMessage into the bottom row of the content table [r5-23].


    Figure r5-23.

    graphics/07fig23.jpg


  3. Save the page.

The Survey Builder application is just one page from completion: Survey Offline.



Macromedia Dreamweaver MX 2004 Web Application Recipes
Macromedia Dreamweaver MX 2004 Web Application Recipes
ISBN: 0735713200
EAN: 2147483647
Year: 2003
Pages: 131

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