This is a javascript library which allows the creation of dynamic and responsive surveys for single-page WebApps
The entire survey workflow is captured in the Survey
object. Here is the Javascript code for the validation example from above
- any elements followed by a
?
are optional arguments - elements followed by
[...]
will take the contents of those brackets as a default parameter - consequently, any element that is followed by
[...]
is also implicitly followed by?
, but for the sake of readibility the?
will not be omitted
Must contain a pages
array which can contain:
page
-- an instance of aPage
object
Each Page
object corresponds to a page of the survey
elements
-- an array containing a mixture ofSurveyError
and its variants,Question
,Title
,Div
. These are the items that will show up on each page of the surveyvisibleIf
?[true] -- a boolean, or a function which returns a boolean -- if true, then the page is included in the survey -- otherwise, it is skipped -- note, if the return type is a function which returns a boolean, then the page's visibility can be conditionalnextBtnText
?["Next ▶︎"] - a string -- the text to appear on the 'next page' buttonprevBtnText
?["◀︎ Previous"] - a string -- the text to appear on the 'previous page' buttonisNextButtonVisible
?[true] -- a boolean -- if true, then the 'next page' button is visible; otherwise, only the 'previous page' button is visible
type
-- one of the enumQuestion.Types
(TEXT
,NUMBER
,DATE
,RADIOGROUP
,CHECKBOX
,DROPDOWN
,HTML
,DYNAMIC_HTML
) -- this type directly affects what other parameters should be included for theQuestion
objectname
-- a string -- a unique name for the questionvisibleIf
-- a boolean or a function returning a boolean -- if true, then this question is visible on the page; otherwise, this question is not present within the DOM
- Add documentation for all the question types
- Add documentation for the
Div
type - Add documentation for the
SurveyError
type - Provide code for the example GIFs