Evaluation, playground project to try implementing a one page application able survey. The reference frontend is implemented using BackboneJS, the trivial reference backend is implemented using a NodeJS server utilizing ExpressJs 4.
- REST API for feedback and surveys
- Survey template as JSON datastructure
- Survey structure and text separated for easy internationalisation
- Simple Javascript library for frontends
- Multiple input element types (see below)
- Texts and survey structure separated
- Steps can depend on other answers values
- Humble responsiveness
- Dumb ExpressJs backend to serve and receive the survey
- The template structure is fed into / as the view's config
- The
Stepview, extended from aGroupmaps the templatetypeto the view class - The survey values are stored into a model; the template's
idwill be the model's key. - The pagination is controlled using a model:
navModel
The template is based on JSON and consisting of a tree structure modeling the GUI elements and a list of translations.
A GUI element at least has this structure:
{type: "<TYPE>", content: <CONTENT>}
TYPEcan bestep,group,text,multiplechoice,rangeorfreetextCONTENTdepends on the type and is an object for every type excepttext, which just contains the I18N referencegroupandstepare similar, they only contain other elementsgroups may contain other groups- All elements may have an
idattribute specifying the key to store the value to
For an example template see /data/form.json.example and the corresponding texts.json.example.
content(Array) Contains other GUI template objectsdepends(String) Simple comparsion expression to match the value of another ID to a hardcoded value. This can be used to make a step dependent on another input element's choice/value. Currently only one comparsion level (<IDENTIFYER> <COMPARATOR> <VALUE>) is possible.
content(Array) contains other GUI template objects
content(String) I18N reference
id(ID)exclusive(boolean) - If true only one option can be active at the timelayout(String) - Control the layout of the buttons. Valid:row,columnchoices(Array) - Objects containing ... --id(ID) --text(String) I18N reference and optionally --free-text(boolean)
id(ID)steps(int) Number of optionslower(String) I18N referenceupper(String) I18N reference
id(ID)
Copy the form and text JSON example files into a subdirectory with a numeric foldername which represents the ID.
$ mkdir /data/47
$ cp /data/form.json.example /data/47/form.json.example
$ cp /data/texts.json.example /data/47/texts.json.example
$ node server/runme.js
Surf to on of the example pages, e.g.: http://localhost:7072/index.html#in-overlay,47
(The format of the hash part is #{in-overlay|standalone},<ID>.)
Send some surveys and take a look into the folder /received/47. You'll find some files with a Unix timestamp as name containing the result data in JSON format.
The accumulated results can be examined under http://localhost:7072/results/47 too.
In early development. Unstable. Probably never done. Not tested. But working.
This code is MIT licensed for you.