Conception: Workflow Mechanism of a YES-NO Questionnaire

7 05 2007

Introduction

Often people like to have a questionnaire with multipage forms, that they can setup and configure on their own. They would like to work with a simple configuration list of questions or with the assistance of a wizzard. It should be able to branch into subforms depending on the selected answers.

Motivation

I have different ideas, how this could be done and want to scratch down my ideas for the first model with a very abstract concept, that I call a pure YES-NO questionary. The other ideas are based on the YES-NO concept. Just like you can build complex programs and data on top of the primitive 0 1 bit structure.

Axiom

My basic assumption is, that you can break down every controlling question (not the text collecting ones) of a questionary to plain YES-NO questions. A checkbox is a YES-NO question. Radiobuttons are list of YES-NO questions, where only one question can result in YES. Multiselections are a list of YES-NO questions, where multiple questions can have a YES answer.

Coins

We bundle all questions, that are necessary to be asked, into a first form. For every question that is answered with a YES we can branch to a subform. The subform itself is assembled in the same way from YES-NO questions, that can branch to further subforms. The result is a tree of forms that would fully be passed, if all questions would be answered with YES. If all answers turn to NO, only the initial form is to be passed.

So the coins of this model are:

  • form tree
  • forms
  • YES-NO questions
  • YES-NO answers
  • pointers form answers to (sub)forms

Implementation

How are the subforms called for each positive answers, while there are multiple questions within one form?

Multiple solutions are possible.

  • A new window in example in form of a popup.
  • Inline inclusion based on AJAX.
  • Postprocessing after submit of the previous form controlled by a stack.

How does the stack work?

Every positive answer would be pushed on top of the stack. As soon as the form is submitted and checked, the stack would be processed. We pop the top entry and replace it by all positive answers of the matching subform. This is done recursively until all forms are done and the stack has been reduced to zero.

Logically not every positive answer has to result in a new subform else the tree would grow infinitely. Positive answers can be leafs of the tree. Then the information is just gathered with all the other results.

When is the collected data stored?

Two basical concepts are possible. Either we store the data directly after submit of each form. This solution is very stable and the vistor can come back at any time to proceed a previously started form fillout. The disadvantage is, that we collect entries into the DB from fillouts that are never finished. The alternative is to store all the data into the session and to store it only if the whole precess has been done. The disadvantage is, that all data will be lost, if the vistor pauses to long.

What happens, if the visitor steps back some forms, to change a YES to NO or vice versa?

If a previous YES is chanted to NO this cuts the complete subbranch. That can be done in several forms:

  • The data of the subbranch is immediatly removed from the session or the database.
  • The data is kept and removed upon the final submit of the whole transaction.
  • The data is kept and stored. In this case it’s necassary to evalute the blocking NO value for the subbranch upon usage of the collected data.

For each NO, that is changed to a YES, the appropriate action needs to be executed, depending by an AJAX include or a popup or by pushing the stack. If we did a previous clearing of a branch during an alteration from YES to NO we need to cycle the branch again.

How is it all configured?

The coins are given. Each form contains a list of questions. Each form needs an ID for the answer form relation. Each question can contain a pointer to a form ID for the case of a positve answer. Thats it. WE can configure it in any configuration language i.e. in — surprise — TypoScript.

How is it controlled?

I suggest an implementation based on the lib/div controller.

What about a wizzard?

If we extend this basical concept a little and use the form pointer in form of a loop and add some other inputs to pick up the questions, a wizzard can be implemented with the YES-NO questionary itself.


Actions

Information

Leave a comment