how can response.button give not just the index of the selection made, but the value of the button itsef? #1501
-
Hi all: I'm brand new to this so apologies for ugly formatting. I am making an experiment in which subjects press a button for the word they think is the prettiest out of three choices. Right now, when I click, the data outputted by Basically, I'd like to output a "word_selected" equivalent to "button_pressed". Any ideas on how I can do that? (I'm going off of jspscyh-html-button-response.js) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @auraangelica, We should make this an official feature of the plugins. I actually thought we already did do this, but after looking more carefully I just imagined that we had implemented this. Once version 6.3 comes out, within the next week or so, it'll be easier to do this because of the new feature that allows saving any trial parameter in the data. Once that feature is launched, you can save the var button_trial = {
type: 'html-button-respose',
stimulus: '<p>Click a button, any button!</p>',
choices: ['A', 'B', 'C', 'D'],
save_trial_parameters: {
choices: true
},
on_finish: function(data){
data.response_label = data.choices[data.response]
}
} Note that I'm using |
Beta Was this translation helpful? Give feedback.
-
In case anyone's wondering, adding this to the
(Full code block)
|
Beta Was this translation helpful? Give feedback.
In case anyone's wondering, adding this to the
jspsych-html-button-response.js
plugins file, undervar trial_data
worked for 6.2!"word_chosen": trial.choices[response.button],
(Full code block)