Javascript (JS) question - store and retrieve values
The Javascript question is in itself not storing any data in the survey. To store and retrieve respondent actions, you need to implement the following code in your javascript
To store data from javascript:
- window.parent.postMessage(JSON.stringify(state), '*');
To retreive data from database into javascript:
- bindEvent(window, 'message', function (e) {
- console.log('Listen to messages from parent window ', e.data);
- const state = e.data;
- });
Also, you can use a global variable "elementsData" in the js component which already contains a saved state.
Getting stored values in a survey:
The JSON value you store and retrieve will be exported as text data in the survey CSV export.
Related Articles
Javascript (JS) question type variables
In the Javascript component, you can use the variables presented below to customize content: {{respondentName}} - Respondent Name {{respondentEmail}} - Respondent E-mail {{respondentNode}} - respondent node {{timesOpenedSurvey}}- How many times ...
Report variables
High level of technical difficulty In the report it is possible to refer to average values of a question or variable within texts. This has the following format: {{seriesID.questionID}} Example ...
Data export
To get raw data from a survey, the tenant admin can download a CSV file from surveys list. Click the download button on the right side of the survey row. The file will be downloaded directly. In the file you will find all completed responses. Where ...
Working with surveys
The Effect IO survey editor is the core of the system. A general overview on how to work with surveys follows. We assume that you have created a new survey and have entered the survey editor. You can also learn more about survey settings here. About ...
Charts in report editor
Currently, the Effect IO report editor is in its infancy, so setting up charts requires some work. After you have created a report, you can navigate to a page, and add the "chart" component. Here, you will be able to the JSON configuration of a ...