Global

Methods

getAllBlockQuestions(_block) → {Array}

Gets all questions for a particular block. Either one question is a branch or all are "branch", and they're always out of the top level block. Put the current block's questions in a global stack that we can empty.
Parameters:
Name Type Description
_block survey.Block The block whose questions we want.
Source:
Returns:
A stack of questions.
Type
Array

getBlockById(bid) → {Block}

Gets the Block object from the internal mapping of ids to Blocks. Throws an exception if the id is not found.
Parameters:
Name Type Description
bid string The block id. May be null.
Source:
Returns:
Type
Block

getOptionById(oid) → {Option}

Gets the Option object from the internal mapping of ids to Options. Throws an exception if the id is not found.
Parameters:
Name Type Description
oid string The option id.
Source:
Returns:
Type
Option

getQuestionById(quid) → {Question}

Gets the Question object from the internal mapping of ids to Questions. Throws an exception if the id is not found.
Parameters:
Name Type Description
quid string The question id.
Source:
Returns:
Type
Question

global_reset()

Resets the lookup maps for blocks, options, and questions.
Source:

handleBranching(q, o) → {survey.Question}

Checks whether the provided question has a "true" branch target for the provided option. Returns the apporpriate question.
Parameters:
Name Type Description
q survey.Question
o survey.Option
Source:
Returns:
Type
survey.Question

initializeStacks(_blist)

Intitalizes the block and question stacks for the interpreter.
Parameters:
Name Type Description
_blist Array.<survey.Block> The list of all top-level blocks.
Source:

isBlockStackEmpty() → {boolean}

Tests whether we have exhaused the blocks in this survey.
Source:
Returns:
Type
boolean

isQuestionStackEmpty() → {boolean}

Tests whether we have exhausted the questions for this block.
Source:
Returns:
Type
boolean

loadQuestions(_qList)

Loads the provided question list onto the question stack; used between blocks.
Parameters:
Name Type Description
_qList Array.<survey.Question> The next set of questions to ask.
Source:

nextBlock() → {survey.Block}

Returns the next block in the survey. If the previous block was a branch-one block, pops off stationary blocks until it either reaches a floating block or the branch destination. If it finds the branch destination first, it resets the branchDest pointer.
Source:
Returns:
Type
survey.Block

nextQuestion() → {survey.Question}

Returns the next question in the survey. If the question stack is empty, this returns undefined.
Source:
Returns:
Type
survey.Question

nextSequential() → {survey.Question}

Returns the next question. If the block stack is empty, refreshes it.
Source:
Returns:
Type
survey.Question

parseBools(thing, defaultVal, question) → {*}

This function parses some object to a boolean, returning the default value if the first argument is undefined. It is exported as a 'private' variable in the SurveyMan.survey object. The parsed object may return:
  • boolean, for most question fields (e.g., randomize, exclusive, etc.)
  • string or regexp, for the freetext field
  • boolean or an array for option ids, for the ordered field
Parameters:
Name Type Description
thing * Any object, possibly undefined.
defaultVal * The default value for this object; may not be undefined.
question Question This is provided for backwards compatibility on the json schema and may be undefined. The 'ordered' field for questions may be a boolean (old version) or an array of option ids (new version).
Source:
Returns:
the parsed object
Type
*