User input - Java toUpper | XM Community
Solved

User input - Java toUpper

  • 22 January 2020
  • 6 replies
  • 18 views

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.
icon

Best answer by TomG 22 January 2020, 22:16

View original

6 replies

Userlevel 7
Badge +27
```
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

Userlevel 7
Badge +27

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