Allow particiapnts to type without needing to click in text box | XM Community
Question

Allow particiapnts to type without needing to click in text box

  • 27 July 2023
  • 4 replies
  • 42 views

Userlevel 1
Badge +2

I have been creating a cued-recall task. Participants will learn word pairs and during the final test they will be presented with the first word and asked to retrieve the second.

As I go through the preview, I keep having to click in the textbox before I can type my answer.

I would like to be able to type automatically without needing to click first.

 

I have tried various versions of:

Qualtrics.SurveyEngine.addOnReady(function()
{
$('NextButton').hide();
if($('PreviousButton')) $('PreviousButton').hide();
var inputText = $(this.questionId).down('.InputText');
var evt = inputText.on('keydown', function(e) {
if(e.which == 13) {
evt.stop();
$('NextButton').click();
}
});
inputText.activate();
});

 and

Qualtrics.SurveyEngine.addOnload(function() {
$(this.questionId).down('.InputText').focus().defer();
});

These were suggestions I had seen in other threads, but nothing seems to be working.

Thanks in advance!


4 replies

Userlevel 6
Badge +20

Hi @arobey 

Try use this code 

Qualtrics.SurveyEngine.addOnload(function() {

var inputText = $(this.questionId).down('.InputText');

    inputText.focus();

 

});

Userlevel 1
Badge +2

Unfortunately no change.

Here are some additional details.

This block only has 2 questions, the Text Entry question and a Timing question that states to proceed after 5 seconds. I have been putting the code in the JavaScript for the Text Entry question.

 

I tried removing the Timing question to see if that was making a difference, but no change.

 

Userlevel 1
Badge +2

New update!

Your suggestion did work!

The issue was caused by “simple layout”.

I turned that off and went back to “classic layout” and now it is working perfectly.

Thank you!!

Userlevel 6
Badge +20

Hi @arobey 

Great.. Glad to know the solution worked at the end.

Leave a Reply