Forum Discussion
Storyline text entry : All caps/Uppercase
Hi there !
I am working on a project with a lot of Text Entries, many of them are product references (which are written in capital letter only).
I know how to use the == (ignore case) condition to check the answers and make the exercises work, but for the learners it would make more sense if they could just write the reference and see it written in capital letters, without having to use Caps Lock.
The idea here is just make things more convenient for the end user, any idea how to do that ?
15 Replies
- stefanocrabaCommunity Member
Hi Salome';
I don't know how you've developed your project so I'm not sure if this solution will work for you;
what about setting up the reference for the variable All Caps? when the user writes it still be lower case but as it loses focus the variable reference would show All Caps;
check the file, it will make more sense;
hope this help;
best regards.
- SalomDesanges-cCommunity Member
Hi Stefano,
Thanks a lot for your answer, it's a great idea !
The problem is that I don't want tt have to different text on my slide : I have several text entries and i would like them to be in capital letters directly in the text entry, it would make more sense for the exercise. - MichaelAnder569Community Member
How many text entries do you have in the project? I can think of a way to do this but it could be more work than it's worth if you have a lot of them.
- SalomDesanges-cCommunity Member
I have something like 20 text entries in my project and on the specific slide I am working on, I have 8 text entries.
I am curious, what ayre you thinking about?
- MichaelAnder569Community Member
I was thinking that a web object could be used for the text entry box. I think this would allow you to change all of the text entered into uppercase. Then that value could be fed to the variable used for the real text entry. If I get time today I'll try to create a working demo.
- TaniaFerrarioCommunity Member
Hi Salomé,
I don't know if you still need to find a solution.
In a course I had the same need, to automatically show in capitalized letters what the user typed in a text entry field, while he was typing.
I solved it by executing this javascript when timeline starts:
$('input[type="text"]').css('text-transform','uppercase')
Hope it can help you!
Ciao,
Tania
- WilliamJohns998Community Member
Hi Tania,
I like the elegance and simplicity of a single line of javascript, but I don't see this working in your sample. Is there an update to this method?
Thanks,
William.
- JordiSerranoCommunity Member
Buenos días. He leído todo lo posible en los posts para que una letra se ponga automáticamente en uppercase, pero no he conseguido encontrar la manera de implementarlo. Como necesito tener un puzzle con uppercase para este lunes, le he dado mil vueltas y al final me ha salido esto:
https://edittec.com/demos/conoceme2/PORFIN/index.html
Si la montaña no viene a mí, entonces mejor que yo vaya a la montaña.
Por cierto, la montaña está aquí:
- WilliamJohns998Community Member
A colleague helped me with this:
Add a trigger on the text entry field:
Execute javascript when TextEntry changes.var player = GetPlayer();
var newVar = player.GetVar("TextEntry");
newVar = newVar.toUpperCase();
player.SetVar("TextEntry", newVar);
(In this example, the variable is called "TextEntry". You'll need to adjust the javascript if you have renamed the variable.)
- BarbaraChoi-238Community Member
I have the same questions about capital letters directly in the text entry. Sorry, I couldn't follow everything you said above. Are you able to send a sample file?
- JenniferHanc395Community Member
Unfortunately, I tried this and it didn't work for me. I made sure to rename my variable TextEntry, like the example. Is there maybe an updated method? I see this was posted 4 years ago. Thank you!
- JenniferMcCo115Community Member
Hello! I tried William's code and it worked for me, but I actually need the learner to enter their first and last name for use in a certificate and I'd like for it format both names with a capital letter. Does anyone know or have a code snippet for changing the text entry value to title case? Thank you!
- WilliamJohns656Community Member
I haven't tried it, but you could try swapping "toUpperCase" to a function called "toTitleCase". See this article: https://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript .
- BarryStoner-7deCommunity Member
Hi William, I wanted to thank you for these lines of code:
var player = GetPlayer();
var newVar = player.GetVar("TextEntry");
newVar = newVar.toUpperCase();
player.SetVar("TextEntry", newVar);
In my case I needed lowecase and your code snippet helped me out.
Many thanks,
Barry