Custom code to pipe in text in past tense or present tense based on previous question answer
Best answer by fleb
Note: Don't forget to define the embedded field in the survey flow
In case your questions are on the same page, you can't use piping since your piped text wouldn't change once the page was loaded.
In this case, you can change an HMTL element each time user clicks on a choice in your first question.
1) Define an HTML element with an id in your second question. You can use something like this: `<div id = "demo">How long have you been with your current employer/were you with your last employer</div>`
2) Add following JavaScript to your first question:
Qualtrics.SurveyEngine.addOnload(function()
{
var ID = this.getQuestionInfo().QuestionID;
var questionObject = Qualtrics.SurveyEngine.getInstance(ID);
var currentResponse;
var my_text;
this.questionclick = function(event, element) {
if(element.type == "radio") {
currentResponse = questionObject.getSelectedChoices()[0];
//this.clickNextButton();
if(currentResponse == 1) {my_text = "How long have you been with your current employer?"}
else {my_text = "How long were you with your last employer?"}
document.getElementById("demo").innerHTML = my_text;
//Qualtrics.SurveyEngine.setEmbeddedData('Aclicked', "T")
}
}
});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.
