Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Javascript - Input string to Uppercase

Evening All,

Thanks so much for all the help so far - my experiment has come together like a dream. I have one last question about input and uppercase letters.

The participants are required to input multi character responses and I'm using the template here https://forum.cogsci.nl/discussion/4737/text-input-form-for-use-with-jatos#latest to save them as a string as independent variables.

However, as the answers may be in German (where they should be capitalised) I thought a work around would be to make all input appear in capitals. Later in the experiment their typed responses are shown to them again and it would look best if they were UPPERCASE.

I am totally new to javascript (and have zero other coding knowledge!) I am trying to get the string created using the code below to 'turn' the input uppercase. I see that there is a function toUppercase() but I don't know at which point to put this in.

I've included a screenshot of what I'm working with. Thanks for any pointers you can give :)

Ali


Comments

  • Hi Ali,

    I think the easiest solution is to convert the strings to uppercase at the very end of the scripts, by adding something like the following line:

    vars.test_input_1 = vars.test_input_1.toUpperCase()
    

    Cheers!

    Sebastiaan

  • Hi @sebastiaan,

    Thanks for that! When I put it at the beginning (in line 2) it works beautifully also - except that the letter typed is displayed lowercase until the next letter is typed....

    Do you know of a way to make the processing simultaneous so that all letters input show as capitals immediately?

    I think for Germans it's quite counter-intuitive to type a noun and see it in lowercase and I don't want to distract them from inputting great words as responses!

    Thanks again (again!)!

    Ali

  • Hi @AliW ,

    Do you know of a way to make the processing simultaneous so that all letters input show as capitals immediately?

    Yes, by putting the line at the end of the script, as I suggested 😉

    Do you know of a way to make the processing simultaneous so that all letters input show as capitals immediately?

    The key thing is to make sure that the conversion to uppercase happens after the key press response is appended to the variable. Otherwise you'll get the behavior that you're describing, in which the keys are only converted to uppercase on the next input cycle.

    Cheers!

    Sebastiaan

  • Hi @sebastiaan,

    THANK YOU!! A fail on my part - In my eagerness I must've had a typo when I tried it at the end, as it didn't do anything first time round and "only worked when I tired it at the beginning"!

    Second time trying it at the end it has worked wonderfully and does exactly what you said! And thank you for the explanation - getting my head around code is taking its time.

    Cheers!

    Ali

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games