Explore the community Forums Lectora Lectora Questions & Answers Capitalize text in entry field

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #352352 Score: 0
    Profile photo of Jason Dalrymple
    Jason Dalrymple
    Member
    beginner
    intermediate
    profile
    wise owl
    curious george
    contributor
    friend finder
    26 pts
    @JasonADal

    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!

    #352439 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    159 pts
    @Klaatu

    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

    • This reply was modified 6 months, 2 weeks ago by Profile photo of Darrel Somoza Darrel Somoza. Reason: typo
    #352452 Score: 0
    Profile photo of Jason Dalrymple
    Jason Dalrymple
    Member
    beginner
    intermediate
    profile
    wise owl
    curious george
    contributor
    friend finder
    26 pts
    @JasonADal

    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…

    #352485 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    159 pts
    @Klaatu

    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

    #352527 Score: 0
    Profile photo of Jason Dalrymple
    Jason Dalrymple
    Member
    beginner
    intermediate
    profile
    wise owl
    curious george
    contributor
    friend finder
    26 pts
    @JasonADal

    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?

    #353184 Score: 0
    Profile photo of Jennifer Valley
    Jennifer Valley
    Moderator
    contributor
    beginner
    friend finder
    advanced
    lectora beginner
    verified member
    wise owl
    profile
    picture perfect
    curious george
    106 pts
    @jvalley4735

    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?

    #353188 Score: 0
    Profile photo of Jason Dalrymple
    Jason Dalrymple
    Member
    beginner
    intermediate
    profile
    wise owl
    curious george
    contributor
    friend finder
    26 pts
    @JasonADal

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

    #353190 Score: 0
    Profile photo of Jennifer Valley
    Jennifer Valley
    Moderator
    contributor
    beginner
    friend finder
    advanced
    lectora beginner
    verified member
    wise owl
    profile
    picture perfect
    curious george
    106 pts
    @jvalley4735

    @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

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.