Question asking time of the day | XM Community
Skip to main content

Hi,

 

does anyone know a way to show a question asking participants to indicate the time of the day in which they performed a certain behavior?


I am looking for a response format in which they can put hours and minutes (possibly using the 24h format), without having a field text which will provide very dirty data.

 

I tried some of the javascript for a time picker I found in the community but I could not make them work.

 

Thank you!

Giulia

Use a text entry question and use JS to change the input type attribute from ‘text’ to ‘time’:

Qualtrics.SurveyEngine.addOnload(function() {
this.getQuestionContainer().querySelectorAll("tinput=text]")=0].setAttribute("type","text");
});

 


Thanks TomG.

 

I tried what you said, but I still don’t get any changes. 

 

I set a text entry question as you said and added the JavaScript as in the pic, but still getting a normal text box in the preview.

What I am doing wrong?

Thanks!

Best


Thanks TomG.

 

I tried what you said, but I still don’t get any changes. 

 

I set a text entry question as you said and added the JavaScript as in the pic, but still getting a normal text box in the preview.

What I am doing wrong?

Thanks!

Best

The selector should be linput=text] instead of ainput=time]


Like this?

Nothing changed. Still getting the same text box as in the previous pic.


Sorry, I had the selector wrong. It should be:

Qualtrics.SurveyEngine.addOnload(function() {
this.getQuestionContainer().querySelectorAll("input[type=text]")[0].setAttribute("type","time");
});

 


Still not working.

 

I am using the preview mode. Could it be that I have to publish the survey to see it work?


It works for me in preview mode:

 


Then I don’t know what else to do.

 

Thanks anyway

Best

Giulia


Actually, it works using a Form Field instead of a Text Entry.

 

Is there a way to make it in 24h format instead of PM/AM?

 

Thanks!


@Giulia_P that’s set by the browser based on the user’s preferences. You can’t control that. At your end, the value will always be in HH:mm format.

 


Leave a Reply