Survey template

This article explains the inner workings of Survey template.

Before we start I encourage you to check Survey template live demo. Register, then login and add a new Survey. Add questions, answers and answer options where necessary. Once done with setup activate the survey. Now you can take survey, view responses etc.

Purchase Survey template for $50

Application setup

Once you create a project using Survey template you can simply build your project and start using it. Security model is simple. There is one user by default (admin/admin) with full access to all data. There is also Guest account enabled with access to Response view Add page so guest users are able to take surveys without logging in.

There is also Registration page enabled. Users can register and create their own surveys. This option is mostly for demo purposes and you may want to turn it off.

Managing surveys

Once you are logged in create a new survey and add questions. Questions are grouped into groups. If you don't need grouping simply add all question to default group (Group 1).

List of surveys is your start screen. You can add or delete surveys here, make them active or inactive, take surveys and view responses.

Each survey is created as inactive. You are free to modify survey structure, add or delete groups and questions. Once you done customizing your survey activate it. Survey activation creates a physical table in the database that will store all responses. You should only activate a survey when you are absolutely certain that your survey setup is finished and will not need changing.

Once a survey is activated you can no longer:

  • Add or delete groups
  • Add or delete questions
  • Add or delete answers

However you can still:

  • Edit your questions code/title/text and advanced options
  • Edit your group names or descriptions
  • Add, remove or edit answer options
  • Change survey name or description

Once data has been entered into this survey, if you want to add or remove groups or questions, you will need to deactivate this survey, which will move all data that has already been entered into a separate archived table.

Typical survey table name is sv_survey_{ID} where {ID} is survey id from sv_surveys table. When survey is deactivated table with responses renamed to something like sv_survey_old_1_20120307233417 (20120307233417 is the timestamp).

List of questions

This is you main single survey management screen. You can add/edit/delete questions, answers and answer options here, reorder groups and questions.

Question types

Survey template allows you to choose from the following question types

 

List

 

List (5 point choice)

 

List (10 point choice)

 

Dropdown box

 

Date

 

Long text

 

Multiple choice

 

Number

 

Multiple choice with comments

 

Radio-buttons

 

Simple text, no question

 

Text

 

File upload

 

Checkbox

Visual appearance and additional files

To tweak visual appearance of your surveys modify the following files (can be found in project directory):
business\Survey\source\templates\survey.htm - 'take a survey' template
business\Survey\source\templates\survey_view.htm - 'view single response' template
business\Survey\source\templates\activate_survey.htm - message displayed in popup before survey activation
business\Survey\source\templates\deactivate_survey.htm - message displayed in popup before survey deactivation
business\Survey\source\survey.css - survey style sheet

HTML templates are similar to standard PHPRunner/ASPRunnerPro templates and use the same template language.

Here is the sample of survey.htm template:

  1.  
  2. <form id="surveyform" action="response_add.php{$page}" method="post">
  3. <input name="a" type="hidden" value="added" />
  4. <input id="locat" name="locat" type="hidden" />
  5. <input id="error" name="error" type="hidden" />
  6. <input name="hash" type="hidden" value="{$hash}" />
  7. <input id="format_date" name="format_date" type="hidden" value="{$format_date}" />
  8. <div class="showtest">
  9. {BEGIN group}
  10. <div class="question">
  11. <div class="qnumdiv">
  12.  
  13. {$group_name}
  14. </div>
  15.  
  16. {BEGIN description_block}
  17.  
  18. {$group_description}
  19.  
  20. {END description_block}
  21. {$questions}
  22. </div>
  23.  
  24. {END group}
  25. <div class="buttons">
  26. {BEGIN prev_button}
  27. <input class="button" onclick="validation('prev');" type="button" value="Prev" />
  28. {END prev_button}
  29. {BEGIN finish_button}
  30. <input class="button" onclick="validation('next');" type="button" value="{$buttonname}" />
  31. {END finish_button}</div>
  32. </div>
  33.  
  34.  </form>
  35.  

Update: Version 1.1, May 24, 2012

In this update:

  • Question preview in popup.
  • View all responses for selected question.
  • New Survey layout. When you create/edit survey choose between Silver-Blue and Grey templates
  • Add optional long question description.
  • Display additional question instructions under the question or on the right.

Grey template


Silver-blue template


Upgrade instructions

If you upgrading your projects from previous version of Survey template and want to keep existing surveys/responses here is what you need to do:

- If you use SQL Server database execute database\db_update.sql script against your existing database. If you use MySQL execute database\dbmysql_update.sql script. This will create new tables and fields. Then create a new project using Survey Template and point it to existing database. Choose 'Use existing' option to reuse existing tables.

- MS Access Survey projects cannot be upgraded automatically. You will need to create a new project and then copy data from old database file to new one manually.

1 comment to Survey template

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>