different default text for a form field question | XM Community
Solved

different default text for a form field question

  • 31 March 2022
  • 4 replies
  • 219 views

Userlevel 2
Badge +1

Can anyone please help me with adding default text that can be different for each of the following fields, this is a form field question. I have the same issue with multiple choice question where I add a text entry box to each option and I want to add a different default text in each box.
Thank you
Screenshot 2022-03-31 at 16.25.16.png

icon

Best answer by Tom_1842 31 March 2022, 22:47

View original

4 replies

Userlevel 7
Badge +27

Hi there, try adding the below to your Form Field question as Javascript in the OnLoad section. Change the "Placeholder#" text as needed.
jQuery("#"+this.questionId+" input[type=text]").eq(0).attr("placeholder", "Placeholder1");

jQuery("#"+this.questionId+" input[type=text]").eq(1).attr("placeholder", "Placeholder2");

jQuery("#"+this.questionId+" input[type=text]").eq(2).attr("placeholder", "Placeholder3");

Userlevel 2
Badge +1

Many thanks Tom_1842!!

Badge +1

HI @Tom_1842 

 

Just tried it but it is still asking to put value on it

 

Userlevel 7
Badge +27

Hi @lerasga, the Placeholder attribute is different from the Value attribute. Where the Placeholder attribute specifies a short hint that describes the expected value of an input field, the Value attribute is used to set the actual value to input elements. So, those Form Fields are still unanswered according to Qualtrics. You could use the below instead to update the Values of the Form Fields, or use Default Choices which will do the same thing.

jQuery("#"+this.questionId+" input[type=text]").eq(0).attr("value", "Value1");
jQuery("#"+this.questionId+" input[type=text]").eq(1).attr("value", "Value2");
jQuery("#"+this.questionId+" input[type=text]").eq(2).attr("value", "Value3");

 

Leave a Reply