Mugo Web main content.

Country, State and Page break questions in eZ Survey

By: Xavier Cousin | April 4, 2011 | eZ Publish add-ons

In addition to the Matrix question type, we have added these question types: Country (dropdown list of countries), State (similar to country but with USA states and Canadian provinces) and Page break (enabling paginated surveys) to the eZ Survey extension.

The Country question type is a dropdown list of countries populated by the default eZ Publish country.ini. The format used to store the country selections can be modified in extension/mugosurvey_addons/settings/mugosurvey.ini.append.php. (The default format is Alpha2.)

The State question type is a dropdown list of USA states and Canadian provinces populated by extension/mugosurvey_addons/settings/mugosurvey.ini.append.php. There is also an extra option "Other State" that enable users to type in a state that is not in the list. At the moment, this question type is not tied to the Country selection.

The Page break question type enables you to create long surveys within the same object and paginate them on the public side. Each survey page will start after each Page break question. This functionality is supported by JavaScript (specifically jQuery).

 

The submit button for the survey is shown on the last page. If there are validation errors, then all questions (and answers) are displayed on one page, but the questions whose answers were valid are hidden on the page in togglable layers. If JavaScript is disabled in the browser, the survey will still be functional as a 1-page survey.

 

Notes:

  • In order to support page break functionality, we had to override the ezsurvey datatype template (extension/mugosurvey_addons/design/standard/templates/content/datatype/view/ezsurvey.tpl). This means that if you have already overridden this template, you will have to manually merge your changes with this extension's changes.
  • Changing the storage format of the Country question type will make all previous answered surveys unreadable for those questions, so choose a format first and stick to it!
  • States and countries are not tied together (and this extension currently only lists USA states and Canadian provinces). This is a feature consideration for a future version.

Download the Mugo Survey Addons extension