Capitalize text in entry field

I'm attempting to set an entry field so that it capitalizes the first word anytime a user enters text. I did search the forum and found the posting "Controlling text entry form field", but when I click on the title from the search results, it doesn't open the thread (Jennifer?)

I saw the response from Sergey re: adding as a meta tag, tried that and was not able to get it to work. I also tried adding a custom class with a JS action or an document.getElement on the object (with the actual object name), both to no avail.

I found in one of the inline stylesheets that the element has ".input.entry338753" (the HTML name) and when I had the text-transform properties, it does work. I'm just not sure how to adjust that using an HTML element or RunJS action. Thanks for the help!

Discussion (7)

Thanks, Darren - that worked like a charm with one little caveat. When I enter a single letter, it doesn't update the variable itself until a second letter is entered (it does capitalize it right away on the screen, though). In this course, I need the learner to be able to enter a single letter in the field as part of a search screen emulation.

In hindsight, maybe a question instead of a straight entry field may have been better, even if it meant setting up more conditional actions...

Ah, good catch. No worries. Where there's a will, there's a way.

Add the following line after the code above:

VarEntry_0001.set(document.getElementById("entry40id").value);

Make sure the variable and ID match yours.

Darrel

Here you go. Put this in an onChange Run JavaScript action on the entry text field. Remember to change the ID to the name of your entry text.

document.getElementById("entry40id").value = document.getElementById("entry40id").value[0].toUpperCase() + document.getElementById("entry40id").value.substring(1);

Darrel

Thanks again, Darren. Jennifer V - is there a coding hero badge you can bestow upon Darren and some others that have been absolutely bang-up on helping me and others with scripting?

@jvalley4735 It happened across multiple browsers (IE, Chrome and Firefox) on my Windows 7 desktop and laptop at work - I just tried again and I get to the page, but there's no thread. I can double check again from home tonight on my personal laptop and tablet as well.

@JasonADal I'll bring it to our developer's attention to see if there's anything we can do on the back end. If you get a chance would you mind taking a video (nothing fancy) or screenshots since I'm unable to recreate it? You can send them over to my email which is jennifer.valley@trivantis.com

I tried to recreate the issue of you not being able to click on the link in the Community but no luck @JasonADal Can you tell me which browser and operating system you're using to access the site?

Discussions have been disabled for this post