User input - Java toUpper | XM Community
Skip to main content
How can I convert user input, in a text entry field, directly to uppercase using Java? I've fumbled around with it, but can't make it work.
```

jQuery("#"+this.questionId+" .InputText").on("input", function() {

this.value = this.value.toUpperCase();

});

```
Nice! Thanks a ton!

https://www.qualtrics.com/community/discussion/comment/21530#Comment_21530This really helped me tremendously! Thanks! (:
Building on, how do you use this code to convert just one field in a form fied to upper case? In my case, I need just the "Email address" field to be in upper case - see screenshot. What's the JS for this?
form.PNG


TomG Hi, I managed to figure that for the first or last field, I could use:
jQuery("#"+this.questionId+" .InputText:first") or jQuery("#"+this.questionId+" .InputText:last")
But how about for fields that are in the "middle" - like the "Email address" in the screenshot?
form.PNG


https://community.qualtrics.com/XMcommunity/discussion/comment/38354#Comment_38354toddusingqualtrics - You can use:
jQuery("#"+this.questionId+" .InputText").eq(1)


TomG That's terrific. It works perfect! (:


Leave a Reply