Preselect a Text Entry | XM Community
Skip to main content
Hello everyone



I want to do a word-completion task. This means participants see a word fragment (e.g. "w_t_r") which they should complete to a full word (e.g. "water"). As I do it currently, I show them the word fragment as text field and below that there is an empty text entry where they should write "water".



This is kind of alright (is that the best way?). Now I want to present them only one word every 6 seconds. So what happens is that I have around 35 blocks with each one word fragment and one entry field. Every 6 seconds there is a new fragment automatically.



Now what I would love is that the text entry field is preselected. So that basically the participants not have to select the text entry every new block. I was told by support that this might work with a custom code?



Any ideas?

Thank you

Jonas
This will focus on the text entry box so the user can start typing without clicking on the box first (I think this is what you are asking):

```

jQuery("#"+this.questionId+" .InputText").select().focus();

```

It seems like you could be using a single loop&merge block instead of 35 separate blocks. You would just pipe the word fragment into the question.
> @TomG said:

> This will focus on the text entry box so the user can start typing without clicking on the box first (I think this is what you are asking):

> ```

> jQuery("#"+this.questionId+" .InputText').select().focus();

> ```

> It seems like you could be using a single loop&merge block instead of 35 separate blocks. You would just pipe the word fragment into the question.



Awesome, that is exactly what I am looking for! Since I am quite unexperienced with code I do not know how to implement it. Because:



Qualtrics.SurveyEngine.addOnReady(function()

{

jQuery("#"+this.questionId+" .InputText').select().focus();



});



Gives me the Error:



#SiteWide.Alert

Invalid JavaScript! You cannot save until you fix all errors: Unexpected token ILLEGAL



How to implement the code? 😀



Thanks

Jonas
Oops, I had a mismatched quote. I updated the code in my original post.
> @TomG said:

> Oops, I had a mismatched quote. I updated the code in my original post.



Awesome! it works perfectly!!

Leave a Reply