Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Commit 585a827

Browse files
Update Qualtrics integration code to consistently use the survey API
1 parent 835cb43 commit 585a827

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

docs/learn/deploy/3a-qualtrics.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ Because the data is saved in the embedded field you set up above, the study is b
4444

4545
<!-- Adjust the page style slightly -->
4646
<style>
47-
/* Hide button for skipping the page */
48-
.NextButton {
49-
visibility: hidden;
50-
}
5147
/* Remove border from last question */
5248
.QuestionOuter:last-of-type .QuestionText {
5349
border: none;
@@ -67,18 +63,20 @@ To achieve the connection, you'll need to add JavaScript logic to the `Descripti
6763

6864
.. code-block:: JS
6965
66+
const page = this
67+
page.hideNextButton()
68+
7069
// Listen for the study sending data
71-
window.addEventListener('message', function(event) {
70+
window.addEventListener('message', function _labjs_data_handler(event) {
7271
// Make sure that the event is from lab.js, then ...
7372
if (event.data.type === 'labjs.data') {
74-
// ... extract the data lab.js is sending.
75-
76-
// We're going to work with JSON data
73+
// ... extract the JSON data lab.js is sending.
7774
const data = event.data.json
7875
7976
// ... save data and submit page
80-
Qualtrics.SurveyEngine.setEmbeddedData('labjs-data', data)
81-
document.querySelector('.NextButton').click()
77+
page.setEmbeddedData('labjs-data', data)
78+
window.removeEventListener('message', _labjs_data_handler)
79+
page.clickNextButton()
8280
}
8381
})
8482

0 commit comments

Comments
 (0)