I need to force lowercase a response (participant’s email) collected via text box and save it as lowercase. Any ideas on how to do this?
Best answer by Tom_1842
View originalI need to force lowercase a response (participant’s email) collected via text box and save it as lowercase. Any ideas on how to do this?
Best answer by Tom_1842
View originalHi
Add JavaScript to the Survey Flow:
- Go to the Survey Flow section of your survey.
- Add a new element and choose "JavaScript."
- Enter the following JavaScript code:
```javascript
Qualtrics.SurveyEngine.addOnload(function() {
// Get the input element by its ID
var emailInput = document.getElementById("yourTextBoxID");
// Add an event listener to the input element to convert input to lowercase
emailInput.addEventListener("input", function() {
this.value = this.value.toLowerCase();
});
});
```
Replace `"yourTextBoxID"` with the actual ID of the text box where participants enter their email.
In the Survey Flow, I do not see an element called "JavaScript". The code looks good though. I’ve edited it to get the ID of the Text Entry question. Try adding the below to the OnReady section of the Text Entry question's JavaScript to force lower case.
var emailInput = document.getElementById("QR~"+this.questionId);
emailInput.addEventListener("input", function() {
this.value = this.value.toLowerCase();
});
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.