@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