Hello Norikazu, you can leverage In-page display logic feature for this use case. Configure the text entry question to only appear if someone has selected “Other” in the above question.
Hello Norikazu, you can leverage In-page display logic feature for this use case. Configure the text entry question to only appear if someone has selected “Other” in the above question.
Thank you very much for your info.
As you pointed out, I implemented display logic and showed whole the project to my client but they asked me to reduce the page transitions as many as possible.
There’re more than 100 questions in the project and so many questions to hide depending on the answers.
@norikazukuriiwa If you want some custom JavaScript to show the city selection and the text entry on one page, you could add this JavaScript to the question which asks for the city:
Qualtrics.SurveyEngine.addOnReady(function() {
var radioButton1 = document.getElementById('QR~' + this.questionId + '~1');
var radioButton2 = document.getElementById('QR~' + this.questionId + '~2');
var radioButtonOther = document.getElementById('QR~' + this.questionId + '~3');
var textBox = document.getElementById('QR~QID17');
// Disable the text box initially when the page loads
textBox.disabled = true;
// Function to handle radio button changes
function handleRadioChange() {
// If the selected radio button corresponds to "Other", enable the text box
if (radioButtonOther.checked) {
textBox.disabled = false;
} else {
// Otherwise, clear and disable the text box
textBox.value = '';
textBox.disabled = true;
}
}
// Attach event listeners to the radio buttons
radioButton1.addEventListener('change', handleRadioChange);
radioButton2.addEventListener('change', handleRadioChange);
radioButtonOther.addEventListener('change', handleRadioChange);
});
You would need to replace the QID17 ith the question ID of the text entry question.
The logic expects “Other” to be the 3rd radio button.
Best
Christian
@norikazukuriiwa If you want some custom JavaScript to show the city selection and the text entry on one page, you could add this JavaScript to the question which asks for the city:
Qualtrics.SurveyEngine.addOnReady(function() {
var radioButton1 = document.getElementById('QR~' + this.questionId + '~1');
var radioButton2 = document.getElementById('QR~' + this.questionId + '~2');
var radioButtonOther = document.getElementById('QR~' + this.questionId + '~3');
var textBox = document.getElementById('QR~QID17');
// Disable the text box initially when the page loads
textBox.disabled = true;
// Function to handle radio button changes
function handleRadioChange() {
// If the selected radio button corresponds to "Other", enable the text box
if (radioButtonOther.checked) {
textBox.disabled = false;
} else {
// Otherwise, clear and disable the text box
textBox.value = '';
textBox.disabled = true;
}
}
// Attach event listeners to the radio buttons
radioButton1.addEventListener('change', handleRadioChange);
radioButton2.addEventListener('change', handleRadioChange);
radioButtonOther.addEventListener('change', handleRadioChange);
});
You would need to replace the QID17 ith the question ID of the text entry question.
The logic expects “Other” to be the 3rd radio button.
Best
Christian
This is exactly what I really wanted!!
This works perfect!!
Thank you very much for your kindness and I could release from the stress at all!