Open chen-goren opened 1 month ago
This is expected behavior of the image-slider-response plugin, as the participant ought to submit their response via a button click and the absence of that button click indicates no response. In your case, you just have to make some tweaks from within on_load
and on_finish
.
In on_load
, add this:
document.querySelector('#jspsych-image-slider-response-response').addEventListener('input', (event) => {
window.slider_value = event.target.value;
});
Then in on_finish
, do this:
data.slider = window.slider_value ?? data.slider_start;
Thank you very much Shaobin-Jiang, it worked!
Hi,
According to the "image-slider-response" (ver. 2.0.0.) documentation, I should get the user's choice for the slider's position in my data file. Yet, I don't get any values besides "slider_start". Therefore, I tried to manually add that value to my data file using: "on_finish: function(data) { data.slider = data.response; } but i only get "null" values... I would appreciate any help...
This is my code so far:
var imageDisplayTrial = { type: jsPsychImageSliderResponse,
stimulus: function () { var img = getRandomImage(); return img; }, trial_duration: 5000,
post_trial_gap: 500,
stimulus_height: 400, stimulus_width: 400, labels: ['+', '-'],
prompt: "
Emotion
", require_movement: false,response_ends_trial: false, min: 0, max: 100,
slider_start: 50, button_label: 'Continue', // This will be hidden via jQuery on_load: function() { $('.jspsych-btn').hide(); // Use jQuery to hide the button when the trial starts }, data: { task: 'image_display', group: selectedGroup }, on_finish: function(data) { data.slider = data.response; } };
Thanks!