User input - Java toUpper | XM Community
Skip to main content
Solved

User input - Java toUpper

  • January 22, 2020
  • 6 replies
  • 43 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.

Best answer by TomG

``` jQuery("#"+this.questionId+" .InputText").on("input", function() { this.value = this.value.toUpperCase(); }); ```

6 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • January 22, 2020
``` jQuery("#"+this.questionId+" .InputText").on("input", function() { this.value = this.value.toUpperCase(); }); ```

  • Author
  • January 22, 2020
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


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • June 27, 2021

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