text entry after the sound stimuli | XM Community
Skip to main content

I am currently designing an experiment that a participant listens to a sound file and records the short answer to it. The current design allows participants to record their responses while listening to sound files. I want the subjects to record their responses after the sound file is finished. In other words, I would like to have a text entry box at the end of the sound file where the participants can record their answers. I would be really grateful if you could let me know the code to make this possible.

FYI, below is the code that I have made for each trial. So far, I have added codes regarding "Next Button' and "setTimeout", so that the participants cannot move on to the next trial by themselves, but automatically move on to the next trial after 15000 ms. I have also added codes to hide audio file, so that they cannot replay the sound file after they hear it once.

Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
$('NextButton').hide();
$('PreviousButton').hide();
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
jQuery('audio').on('ended', function() { jQuery(this).hide(); });
setTimeout(function () {jQuery('#NextButton').click();},15000);

Thank you very much!

In the addOnReady function add below line:
jQuery("#"+this.questionId+" .InputText").hide();
Change your code with the below in OnReady:
var that =this;
jQuery('audio').on('ended', function() {
jQuery(this).hide();
jQuery("#"+that.questionId+" .InputText").show();
});
Also, I wonder that is 15 seconds enough to hear the sound and write the answer for it.


rondev
Thank you very much for sharing your code. Your code works very well!
To answer your question, my sound stimuli are very short (less than 4 seconds) so 15 seconds would be enough time for participants to write their responses.

Again, thank you very much!


Leave a Reply