SoSci Survey automatically embeds a JavaScript library SoSciTools
in the questionnaire. This can be used in JavaScripts within the questionnaire.
The following static methods are available through SoSciTools:
SoSciTools.getForm()
– Returns the HTML form element <form>
of the questionnaire.SoSciTools.disableInputs()
– Deactivates all input and selection fields on the current questionnaire page (e.g. to display questions again without the participant changing anything, see also answers())SoSciTools.disableInputs2()
– Replaces all input and selection fields with graphics or text elements.SoSciTools.questionnaire
– instance of SoSciTools.Questionnaire
to control the questionnaire pageSoSciTools.progress
– Instance of SoSciTools.Progress
to control the progress bar.SoSciTools.submitPage()
– Transmit the responses of the current page, as if the Next button was pressed.SoSciTools.submitButtonsHide()
– Hide next and back buttonSoSciTools.submitButtonsDisplay()
– Show next and back buttonSoSciTools.showButtons()
–Display of Next and Back button or other buttons (language switcher, cancel interview, interrupt interview) controlSoSciTools.submitButtonEnable()
– Switch the Next button active or inactive (disabled)SoSciTools.attachEvent()
– Assigns a function to one or more JavaScript events (cross-browser)SoSciTools.attachEventToForm()
– Assigns a function to any change within the questionnaire page (cross-browser)SoSciTools.detachEvent()
– Detaches a previously assigned function from a JavaScript event (cross-browser).SoSciTools.dispatchEvent()
– Triggers a JavaScript event (cross-browser)SoSciTools.getSender()
– Determines the source object of a JavaScript event (cross-browser).SoSciTools.inArray()
– Checks if an element is contained in an array (cross-browser)SoSciTools.recordTime()
– records the processing time in an internal variable, see also LatencyTimer. SoSciTools.dynamicRows()
– shows the input fields of a text input question as needed.
The variable SoSciTools.questionnaire
hosts an object of the class SoSciTools.Questionnaire
.
The object supports the following methods:
The variable SoSciTools.questionnaire
hosts an object of the class SoSciTools.Questionnaire
attachCheck()
– Registers a function to check the input. The function is called when the participant uses the Next button.submit()
– Transmit the responses of the current page, as if the Next button was pressed.
The variable SoSciTools.progress
contains an object of the class SoSciTools.Progress
and supports the following methods:
set()
– Changes the displayed percentage value. Unlike the PHP function option('progress', ...)
, this does not affect the percentage value displayed on the following page.