How do I create a section of text that respondents can edit? I want to show a written passage that’s several paragraphs long and give respondents the opportunity to edit only the first paragraph.
How do I set up a block of text that respondents can edit?
Best answer by Sachin Nandikol
Hello
Add a ‘Text Entry’ question to your survey. Update the header to include an instruction for the customer, such as: “Please edit Paragraph 1 only”.
Next, insert your paragraphs into the text entry box.
Then, add the following JavaScript, replacing the placeholder text ‘Paragraph’ with the actual content of the respective paragraph wherever it appears.
Qualtrics.SurveyEngine.addOnload(function() {
// Get the text entry box
var textBox = jQuery("#" + this.getQuestionContainer().id + " .InputText");
// Pre-fill the text box with the passage
var prefilledText = "Paragraph 1: Paragraph 1 content.\n\n" +
"Paragraph 2: Paragraph 2 content.\n\n" +
"Paragraph 3: Paragraph 3 content.";
textBox.val(prefilledText);
// Disable editing for all text except the first paragraph
textBox.on("input", function() {
var currentText = textBox.val();
var paragraphs = currentText.split("\n\n");
// Keep only the first paragraph editable
if (paragraphs.length > 1) {
paragraphs[1] = "Paragraph 2: Paragraph 2 content.";
}
if (paragraphs.length > 2) {
paragraphs[2] = "Paragraph 3: Paragraph 3 content..";
}
// Reassemble the text and update the text box
textBox.val(paragraphs.join("\n\n"));
});
});
I found this code online and tested it in my lisence, its working as expected.
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
