Howdy, Stranger!

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

Supported by

Recording participant email address

edited September 2020 in OpenSesame

Note: Due to a strange issue with the forum this post failed to render. I [Sebastiaan] therefore posted it as a comment below.

Comments

  • Hello!

    I am designing an online experiment and I need to record the participants email address in order to include them in a draw for winning a prize.

    I tried to modify an already existing loop with an inline java script that was designed to record participant’s student ID :

    https://forum.cogsci.nl/uploads/270/FHI28IF56H34.png There was an error displaying this embed.



    https://forum.cogsci.nl/uploads/626/97CWIVZOW7KM.png There was an error displaying this embed.



    https://forum.cogsci.nl/uploads/649/5EU03FR3S0J3.png There was an error displaying this embed.



    I changed the script so in the ' if statement' the 'vars.response' matrix included other keys (letters, dot, etc.), but it doesn’t seem to work and it only records numbers in the student_number variable (not sure but probably because strings can’t be stored in a variable)


    Anyway I was wondering if there was a way for me to be able to record the participants email address (they will need to see what they are typing and also be able to erase mistakes) ?


    Thank you,

    Sana

  • Hi @Sana_2 ,

    (As you probably noticed, something weird happened with this post. I fixed it by copy-pasting your question in my previous comment.)

    I changed the script so in the ' if statement' the 'vars.response' matrix included other keys (letters, dot, etc.), but it doesn’t seem to work and it only records numbers in the student_number variable (not sure but probably because strings can’t be stored in a variable)

    That would indeed be the way to go. I suspect that there was simply something wrong with the if statement. Could you post the code here?

    Cheers!

    Sebastiaan

  • edited September 2020

    Hello Sebastiaan,

    Thank you for your response!

    Yeah it seems so.... perhaps cause I accidentally posted it twice and tried to erase it but couldn't (not sure). Anyway thanks for responding here!


    Here is the code:


    console.log(vars.response)
    if (vars.response in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","z","y","@",".","-","_","space","slash"]) {
        vars.student_number += vars.response.toString()
    } else if (vars.response === 'backspace') {
        vars.student_number = vars.student_number.toString().slice(0, vars.student_number.toString().length - 1)
    }
    


    Just to clarify when I check the student_number variable afterwards only the numerical values are recorded and the other keyboard responses are just empty cells (this also results to only seeing the numerical keyboard responses on screen when typing in the email address)


    Thank you very much for assisting on this !

    Sana

  • Hi @Sana_2 ,

    I suspect that the issue is simply that the keys have slightly different names from the ones that you're assuming in the if statement. After every key press, var.response is printed out to the browser console, so you can go there and check what the keys are actually called and then modify the key names in your script accordingly.

    Also: right now you're simply appending the key names to var.response , and therefore "two words" becomes "twospacewords", if you see what I mean. So you'll probably have to use a slightly more complex if statement that checks the key name, and then appends the correct character in case that's not equal to the key name.

    Cheers!

    Sebastiaan

  • Hi Sebastiaan,

    Thank you for bringing the "space" issue into my attention I tried solving it by adding an extra condition


    I checked the browser console and except for a few key names like( @, .,/,-,_) the rest of the keys seemed to have similar names. Even when I removed the questionable keys the problem still remained. Also, when I run the script in the traditional (non-browser) way in OpenSesame I still have the same issue.


    Thank you,

    Sana

  • I attached a simple demonstration experiment that accepts email addresses. It's a modified version of the multiple-character input script. Actually the only thing that needed to be changed is the list of allowed keys in the keyboard_response item!


  • Oh wow! That was a lot simpler than the things I tried...

    Thank you very much for your help!

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