different default text for a form field question | XM Community
Skip to main content

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

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");


Many thanks Tom_1842!!


HI @Tom_1842 

 

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

 


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+" inpututype=text]").eq(0).attr("value", "Value1");
jQuery("#"+this.questionId+" inpututype=text]").eq(1).attr("value", "Value2");
jQuery("#"+this.questionId+" inpututype=text]").eq(2).attr("value", "Value3");

 


Leave a Reply