Survey

visual Survey

Survey Stimulus.

Constructor

new Survey(options)

Source:
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
name String

the name used when logging messages from this stimulus

win Window

the associated Window

surveyId string <optional>

the survey id

model Object | string <optional>

the survey model

units string <optional>
"norm"

the units of the stimulus (e.g. for size, position, vertices)

pos Array.<number> <optional>
[0, 0]

the position of the center of the stimulus

ori number <optional>
0.0

the orientation (in degrees)

size number <optional>

the size of the rendered survey

depth number <optional>
0

the depth (i.e. the z order)

autoDraw boolean <optional>
false

whether the stimulus should be automatically drawn on every frame flip

autoLog boolean <optional>
false

whether to log

Extends

  • VisualStim

Methods

(protected) _augmentQuestionNames()

Source:

Augment the model question names with model names.

(protected) _estimateBoundingBox()

Source:

Estimate the bounding box.

(protected) _initSurveyJS()

Source:

Init the SurveyJS.io library and various extensions, setup the theme.

(protected) _onCurrentPageChanging()

Source:

Callback triggered when the participant changed the page.

(protected) _onFlowComplete()

Source:

Callback triggered when we have run through the whole flow.

(protected) _onQuestionValueChanged(survey, questionData)

Source:

Callback triggered whenever the participant answer a question.

Parameters:
Name Type Description
survey
questionData

(protected) _onSurveyJSComplete(node, surveyModel, options)

Source:

Callback triggered when the participant has completed a SurveyJS Question Block.

Parameters:
Name Type Description
node Object

super-flow QUESTION_BLOCK node

surveyModel

the associated SurveyJS model

options

the SurveyJS model options

(protected) _processSurveyData()

Source:

Go over required surveyModelData and apply randomization settings.

(protected) _registerCustomExpressionFunctions() → {void}

Source:

Register custom SurveyJS expression functions.

Returns:
Type
void

(protected) _registerCustomSurveyProperties() → {void}

Source:

Register custom Survey properties. Usially these are relevant for different question types.

Returns:
Type
void

(protected) _registerWidgets() → {void}

Source:

Register SurveyJS widgets.

Returns:
Type
void

(protected) _runQuestionBlock(node, surveyData)

Source:

Run a QUESTION_BLOCK as a SurveyJS survey.

Parameters:
Name Type Description
node Object

super-flow QUESTION_BLOCK node

surveyData Object

the complete surveyData (model)

(protected) _updateIfNeeded()

Source:

Update the stimulus, if necessary.

evaluateExpression(expression) → {any}

Source:

Evaluate an expression, taking into account the survey responses.

Parameters:
Name Type Description
expression string

the expression to evaluate

Returns:

the evaluated expression

Type
any

getResponse()

Source:

Get the survey response.

hide()

Source:

Hide this stimulus on the next frame draw.

onFinished(callback) → {void}

Source:

Add a callback that will be triggered when the participant finishes the survey.

Parameters:
Name Type Description
callback

callback triggered when the participant finishes the survey

Returns:
Type
void

save() → {Promise.<ServerManager.UploadDataPromise>}

Source:

Upload the survey response to the pavlovia.org server.

Returns:

a promise resolved when the survey response has been saved

Type
Promise.<ServerManager.UploadDataPromise>

setModel(model, logopt) → {void}

Source:

Setter for the model attribute.

Parameters:
Name Type Attributes Default Description
model Object | string

the survey model

log boolean <optional>
false

whether to log

Returns:
Type
void

setSurveyId(surveyId, logopt) → {void}

Source:

Setter for the surveyId attribute.

Parameters:
Name Type Attributes Default Description
surveyId string

the survey Id

log boolean <optional>
false

whether to log

Returns:
Type
void

setVariables(variables, excludedNamesopt) → {void}

Source:

Set survey variables.

Parameters:
Name Type Attributes Default Description
variables Object

an object with a number of variable name/variable value pairs

excludedNames Array.<string> <optional>
{}

excluded variable names

Returns:
Type
void