Is there a way to add placeholder text to text entry questions? | XM Community
Solved

Is there a way to add placeholder text to text entry questions?

  • 11 November 2017
  • 11 replies
  • 1249 views

Userlevel 4
Badge
Is there a way to add placeholder text to text entry questions?
icon

Best answer by lillianc 14 November 2017, 21:08

View original

11 replies

Userlevel 4
Badge +2
Oh this is a really interesting question (If I'm understanding correctly, having a greyed out "Please tell us" or something like that in the blank prior to a participant filling it out?).

I'd be really curious to know this too!
Userlevel 4
Badge
> @RachelTHREE said:
> Oh this is a really interesting question (If I'm understanding correctly, having a greyed out "Please tell us" or something like that in the blank prior to a participant filling it out?).
>
> I'd be really curious to know this too!

Yep, that's exactly what I'm wondering!
Userlevel 5
Badge +7
From the text entry question, click the gear icon to the left. There is an option to Add Default Choices. You can enter your default text in the text entry box and save. The default text will appear inside the text box.
Userlevel 4
Badge
Perfect, thank you!
Badge +1
Is there a way to make the default responses read-only?
> @Christaann said:
> Is there a way to make the default responses read-only?

Paste the following code in js(OnReady)

`jQuery("#"+this.questionId+ " .InputText").attr("readonly",true);`
Badge +1
Fabulous! Thank you!
Badge +1
Does this work for multiple choice questions, too? For example, I want a response option in a multiple choice question to be selected and read only.
Badge +2
@Goldie @RachelTHREE I found some javascript code in this thread that shows how to include placeholder text that disappears when the respondent starts typing!

Adding my take here, as it's the first result on Google, and there are lots of variable answers in the linked answers.
Placeholder text should disappear when the user starts typing, and won't be submitted as a value if it's left blank.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefplaceholder

  • Click the "cog" button to the left of the question needing placeholder text, then "Add Javascript…"

  • clear the default code, and paste the following code

  • update the
    PLACEHOLDER
    variable (in the example it's "
    dd/mm/yyyy
    ")

  • save

Qualtrics.SurveyEngine.addOnReady(function() {
var PLACEHOLDER = 'dd/mm/yyyy';
jQuery('#QR\\\\~' + this.questionId).attr('placeholder', PLACEHOLDER);
});
This works for
input
and
textarea
(short and long text questions), and will survive the question being dragged into a new order.

Note that the Default Text option selected as the answer to this question may result in the default text being recorded as an answer:

The Add Default Choices feature pre-selects an answer choice for your respondent. So if a respondent decides to skip this question, then your results will still display data as if the respondent had given an answer.

https://www.qualtrics.com/support/survey-platform/survey-module/question-options/add-default-choices/

Leave a Reply