Whether you would like to present a set of questions as part of an application process, event registration, or request feedback from your users, clients or colleagues, Fakoli's questionnaire and survey tool can be configured to meet your needs.
Generic stand-alone tools like Survey Monkey are great when they meet your needs but if you need a questionnaire or survey to be seemlessly integrated into your application, then you need customized code. Fakoli offers the best of both worlds by providing a set of question rendering and results management classes that can be used with your customize component to minimize your effort.
Let's start with the basics - how do we define a questionnaire? We think of a questionnaire as any set of questions that a user can configure so that the set of questions is in the end rendered like an AutoForm. AutoForm uses a DataItem object that is typically one table in the database and renders its columns as fields. A text field is rendered as an html text box, a string field is rendered as a string input field, etc. For example, the table "site_user" would be rendered in AutoForm with a string input field for users to enter their name, email, and choose a password. With questionnaire, we use a question table with columns that define how the question is rendered as a field in the form. The set of questions belonging to one questionnaire would together be displayed like an AutoForm.
A component that wishes to present a questionnaire should start with the datamodel, handlers, and pages in the questionnaire component. In addition to providing classes for use in implementing components, the questionnaire component provides a sample set of questionnaire datamodels, handlers, and pages that a fully functional, though probably not useful in the real world. You can try out Fakoli's questionnaire by copying the questionnaire pages into one of your application's sections using CMS Web Site Configuration => Sections. You can try out the interface for creating a questionnaire, defining its questions, responding to the questionnaire, and viewing the aggregated results.
To create a customized questionnaire component, you must create the following tables and define them in a DataItem class in your component's datamodel folder:
- questionnaire, survey or any table that is linked through its key to a question table so that it can retrieve its set of questions. If a set of questions is linked to some other table such as "event", "registration", or "application", then the that table is used and the question table would link to that table's primary key instead of a questionnaire_id. The DataItem class for this table should extend "AbstractQuestionnaire".
- question table that defines the question and also links to a questionnaire table. The DataItem class for this table should extend "AbstractQuestion".
- response table that can retrieve the set of answers from one respondent to a questionnaire. The DataItem class for this table should extend "AbstractQuestionnaireResponse".
- answer table that links a response to one question and its answer value. The DataItem class for this table should extend "AbstractQuestionnaireAnswer".
- question_xref (optional) used to link one question to a questionnaire or survey in cases when question reuse among multiple questionnaires or surveys is desired.
The Fakoli question table contains the following fields:
- question_id: the key to the table
- questionnaire_id: references the questionnaire table
- question_number: the order in which this question should be displayed within the set
- question_type_id: references the question_type table which indicates whether the question is rendered as a multiple choice (radio button) question, a checklist, a drop down, a free text or short text question, or a ratings question.
- question: the text of the question
- question_name: the abbreviated question text used as the column heading in a spreadsheet view of results (optional).
- options: the set of options for the respondent to choose from when the question is a checklist, drop down, multiple choice, or ratings question
- required: whether the respondent is required to answer the question.
- char_limit: for free text and short text questions, optionally limits the number of characters in the response.
- num_rows: for free text questions, the number of rows to display in the text box presented for response.
- context_help: provides explanatory text for the question in the same way that the context_help component and be used to provide explanatory text for DataItems.
The set of pages in the implementing component can vary. The questionnaire component's sample set are as follows:
- questionnaire_dashboard: displays a table list view of questionnaires and the most relevant or important descriptive data about them, such as a title, description, date, number of responses, etc. This list may contain a column with actions that can be performed on a questionnaire such as delete, edit, and view results.
- questionniare_form: enables create and update of the fields within the questionnaire table, such as title.
- questionnaire_questions: displays a table list view of all the questions linked to the questionnaire. This table typically shows the question text, the question type, the option set, whether the question is required, and provides an option to delete or remove the question.
- questionnaire_question_form: enables creation of a new question or editing of an existing question. Using the class QuestionFormHelper, this AutoForm displays only the fields of the question table that are applicable to the question type selected in the drop down. For example, when creating or editing a multiple choice question, the fields char_limit and num_rows are not displayed.
- questionnaire_preview: displays relevant fields of the questionnaire and its questions, rendered according to their question type as a read only form.
- questionnaire_responses: displays a table list view of the responses to the questionnaire with relevant data about the response, such as the respondent's name, and a link to display the answers given to the set of questions.
- questionnaire_graphs: displays a graphical view of questionnaire results using svg_charts.
- questionnaire_data_table: displays aggregated results for each question as numeric counts of responses to each option or the set of text responses to free text or short text questions.
- questionnaire_spreadsheet: displays responses to the questionnaire as rows of a spreadsheet with a column for each question.
Implementing components may need the following handlers in their handlers folder:
- clone_questionnaire_dialog: displays a modal dialog with an input box to enter a title to save a questionnaire as a copy or clone with a new title.
- question_delete: deletes a question from a questionnaire. Components that use a question_xref table will have a question_remove handler instead.
- question_names_dialog: enables the user to customize the column heading for each question on the questionnaire spreadsheet page.
- questionnaire_delete: deletes one instance of a questionnaire. Typically called from the dashboard page.
- questionnaire_view: displays in a modal dialog, the questionnaire title along with any other relevant data in the questionnaire table and its set of questions.
- reorder_questions: implements the data list view draggable question reordering on the questionnaire_questions page.
- response_view: displays one respondent's answers in a modal dialog. Typically called from a link on the questionnaire_responses page.
Whew! That's a lot of work to create my questionnaire component. Yes and no. On each page and handler file, the code needed is minimized by relying on the questionnaire manager classes to handle bits and pieces of code and javascript so you don't have to. Questionnaire manager classes provide an interface between your custom component and the standard or generic classes. Manager classes act like contractors asking, "Tell me a little bit about yourself and I'll see what I can do to help." In your implementing component, you need to create the following manager classes:
- QuestionnaireDashboardManager: (optional) provides support for a dashboard or list page. This class must extends AbstractQuestionnaireDashboardManager.
- QuestionnaireCreateManager: provides support for the pages that enable a questionnaire to be created, updated, and viewed. This class must extend AbstractQuestionnaireCreateManager.
- QuestionnaireResponseManager: provides support for the respondent's interface. This class must extend AbstractQuestionnaireResponseManager.
- QuestionnaireResultsManager: provides support for displaying questionnaire results. This class must extend AbstractQuestionnaireResultsManager.
The manager classes need to supply information about their implementation such as the following:
- component name (e.g., client_survey)
- question DataItem class (e.g., ClientQuestion)
- answer class (e.g., ClientAnswer)
Specifics for implementing these manager classes can be found in the
code comments and by reviewing the abstract class's abstract functions. And if you enjoy creating extra work for yourself, you can add functions to supply your own custom names for things like handler files. For example, if you really want to call the handler file that reorders questions "reorder_selected_questions" instead of "reorder_questions", you can add a function to your QuestionnaireCreateManager called getReorderHandler and return "reorder_selected_questions" and viola, the questionnaire manager will call this handler for you instead of the default handler "reorder_questions".
Now let's peek under the hood and see how the manager classes help you to interface with questionnaire component classes to render your questionnaire form and view the results.
- QuestionnaireForm: takes an instance of your QuestionnaireResponseManager and uses it to retrieve the set of questions and display the response form for the respondent to enter answers. This class creates a renderer for each question based on its question type: Multiple Choice, Select or Drop Down, Ratings, Short Text, Free Text, or CheckList.
- QuestionnairePreview: extends QuestionnaireForm and uses an instance of your QuestionnaireCreateManager to draw a preview of the questionnaire as a read only form.
- QuestionnaireResponseView: extends QuestionnaireForm and uses an instance of QuestionnaireResponseManager to display one respondent's answers to the questionnaire in summary view (as simple text answers without the html formatting).
- QuestionnaireDataView: uses an instance of your QuestionnaireResultsManager to display aggregated questionnaire response data in tabular format.
- QuestionnaireGraphicalView: uses an instance of your QuestionnaireResultsManager to display a graphical view of aggregated response data.
- QuestionnaireSpreadsheetView: uses an instance of your QuestionnaireResultsManager to display response data in spreadsheet format where each row is one respondent's answers and each column is one question's answer values.
So we've looked how you can configure a component to display questions as part of another workflow, like registration for an event, but what if you'd like to send out requests for responses, like a survey? Well, for that, we have the survey component.
The survey component uses the questionnaire component (our components are incestuous that way) to create a questionnaire and then send it to specified email addresses with a response token that works like a password to gain access to the survey. The survey component lets you keep track of how many recipients have not yet responded and send them reminders. The survey component has a set of manager classes that extend the questionnaire manager class and one additional class, the SurveySendManager class.
As awesome as the survey tool is, we Fakoli developers understand that you might need something just a bit different. You might want to select survey recipients from a table in your database, like a client table, rather than entering email addresses individually. You may wish to link a survey to some other item in your application, such as a project or program. To do this, you can either override the survey component by creating a component of your own called "survey" or you can keep the generic survey component running and create a new component, such as "client_survey". If you don't override survey, you'll need to alter the class names to avoid conflicts (e.g., your SurveyCreateManager could be named ClientSurveyCreateManager) and you'll need to create another set of tables and DataItem classes to define the survey, questions, responses, and answers.
We hope that helps you get started with Fakoli questionnaires and surveys. Happy coding.
Progressive Search Field Renderer »
« CompoundSelectFieldRenderer is here to help YOU!