new Question(_jsonQuestion, _block)
The Question object holds a single question.
Parameters:
| Name | Type | Description |
|---|---|---|
_jsonQuestion |
JSON | |
_block |
Question |
- Source:
Members
block :Block
The block containing this question
Type:
- Source:
breakoff :boolean
Boolean indicating whether we should allow people to submit the survey at
this question.
Type:
- boolean
- Source:
correlation :string|Array.<string>
Either a string or a list of strings corresponding to questions we expect
to be correlated with this question.
Type:
- string | Array.<string>
- Source:
exclusive :boolean
Determines whether we should display options as radio or checkbox.
Type:
- boolean
- Source:
freetext :boolean|string|RegExp
Provides freetext data about this question.
Type:
- boolean | string | RegExp
- Source:
id :string
String representation of the internal id of this question
Type:
- string
- Source:
makeBranchMap :function
Creates the branch map from options to blocks
Type:
- function
- Source:
options :Array.<Option>
The list of options associated with this question (may be empty).
Type:
- Array.<Option>
- Source:
ordered :boolean|Array.<string>
Boolean or ordered list of option ids.
Type:
- boolean | Array.<string>
- Source:
qtext :string
The text to display with this question (may contain HTML).
Type:
- string
- Source:
Methods
(static) makeQuestions(_jsonQuestions, enclosingBlock) → {Array}
Creates question list from the json encoding of question options.
Parameters:
| Name | Type | Description |
|---|---|---|
_jsonQuestions |
JSON | |
enclosingBlock |
Block |
- Source:
Returns:
- Type
- Array
add_option(option)
Adds the provided option to this question. If the question and if option ids are not
semantic, the ordered field will be a list. Adds the new oid to the end of the list.
That is, this function assumes that for ordered options, options will be added in order.
Parameters:
| Name | Type | Description |
|---|---|---|
option |
Option | The option to add to this question. |
- Source:
equals(that) → {boolean}
Two questions are equal if their fields are equal; note that this is not
the same definition of equality as in the SurveyMan analyses.
Parameters:
| Name | Type | Description |
|---|---|---|
that |
* | The object to compare |
- Source:
Returns:
- Type
- boolean
getOption(oid) → {Option}
Returns the Option object associated with the provided option id.
Parameters:
| Name | Type | Description |
|---|---|---|
oid |
- Source:
Throws:
ObjectNotFoundException if this question does not contain an
option with the provided id.
Returns:
- Type
- Option
randomize()
Function to randomize the contents of this question.
- Source:
setFreetext(freetext) → {RegExp|boolean|string}
Function used to parse the provided freetext.
Parameters:
| Name | Type | Description |
|---|---|---|
freetext |
- Source:
Returns:
- Type
- RegExp | boolean | string
toJSON() → {Object}
Returns the json representation of this question.
- Source:
Returns:
- Type
- Object