I’m currently using the new auto-complete feature in connection with an open text box. In my setting, participants report their supervisors name which is then encrypted and the original inputs are deleted afterwards using the script from this thread.
Because I cannot risk having typos, participants need to pick the name from a list, instead of a free text entry. As each organization has more than 100+ supervisors, turning on auto-complete is good compromise.
If I just use the regular text box without auto-complete, everything works fine. However, if I turn on the auto-complete feature, my javascript the name, but is not able to permanently change it. I suppose I need to access the field in a different way, but I’m not sure how.
This is the code I’m currently using:
Qualtrics.SurveyEngine.addOnReady(function() {
var questionId = this.questionId;
var textEntryField = document.querySelector('#' + questionId + ' input');
// Get the embedded data variable DELETE
var deleteValue = Qualtrics.SurveyEngine.getEmbeddedData('DELETE');
// Check if the embedded data variable DELETE is equal to true
if (deleteValue === 'TRUE') {
// Replace the value
textEntryField.value = 'THIS NAME WAS REMOVED';
// Click the next button
var nextButton = document.querySelector('#NextButton');
if (nextButton) {
nextButton.click();
}
}
});
Happy for any advice!