Skip to content

Retrieve data from survey-html-form #1260

Discussion options

You must be logged in to vote

Hi Christina,
The problem here is that the value of responses starts off as an object of key-value pairs (question names and text responses), and JavaScript objects can't be stored directly in the jsPsych data, so they have to be stored as a JSON-formatted text. So when trying to access the responses object, you just need to convert the JSON text back to JavaScript with JSON.parse(). Try this:

var form_trial = {
    type: 'survey-html-form',
    preamble: '<p>Please, type in the digits you just heard in the correct order.</p>',
    html: '<p><input name="digits" type="text"/></p>',
    button_label: 'Submit',
    on_finish: function(data) {
        var data = JSON.parse(jsPsych.data.get().l…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@christinalubinus
Comment options

Comment options

You must be logged in to vote
3 replies
@christinalubinus
Comment options

@becky-gilbert
Comment options

@christinalubinus
Comment options

Answer selected by jodeleeuw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants