Howdy, Stranger!

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

Supported by

How to collect response time with "Form_Text_Input" and Javascript?

Hello everyone,

I've been trying to measure "time_form_text_input" with Opensesame. The reason why I decided to use "form_text_input" is because the experiment that my professor and I are working on requires the participant to submit their responses in writing. They are required to submit an essay of sort, and we plan to time how long does it take to write their answers down. However, while the code works when I tested it on Opensesame (it recorded the "time_form_text_input"), it refused to work on JATOS, both local and remote. I am wondering if I missed something from my code.

Here I have uploaded the test version of the experiment. The experiment will have a similar structure to this one.

This how the items are arranged:


This is the code that I use for the "inline_javascript" that is before the "form_text_input":


This is the code that I use for the "inline_javascript" after the "form_text_input":


I have tried different versions of the code, and I've tried putting it in the "prepare" stage and the "run" stage, but none of them seems to work. I'm sure I'm missing something, but I'm not sure what goes wrong. Do you have any advices on what I should do? Any kind of help will be greatly appreciated.

Thank you so much in advance for your help.

Best Regards,

Joshua

Comments

  • Hi @Joshua_Gabriel ,

    There are two issues here:

    • This code should be in the Run phase, because that's when the participant actually responds
    • The start time and response time should be attached to the vars object so that they are preserved across scripts and logged. (In OpenSesame 4.0/ OSWeb 2.0, variables will be persistent, but right now they are not yet, see also here.)

    However, OpenSesame also automatically keeps track of timestamps through time_[item name] variables. So you can probably already infer the response time from these! See also here.

    — Sebastiaan

  • Hi @sebastiaan

    Thank you for your reply. I have tried fixing the code per your advice. I have moved the code to the Run phase, and I have tried to attach the start time and response time to the vars object. Here's what I came up with:

    I have also put "time_[item name]" variables on the "logger". However, just like before, while it indeed worked while I tested it on Opensesame, it still doesn't work when I uploaded it to JATOS, both the local one and the one on Mindprobe.

    Is it possible that there are some issues when the experiment is converted for JATOS?

    Thank you for your attention.

    Best Regards,

    Joshua

  • Hi @Joshua_Gabriel ,

    You're using the var keyword to declare a variable. However, you need to use properties of the vars object. Specifically, before the form, you have a script that logs the start time:

    vars.start_time = Date.now()
    

    And after the form you have another script that logs the end time:

    vars.end_time = Date.now()
    vars.response_time = vars.end_time - vars.start_time
    console.log(vars.response_time)
    

    Hope this helps!

    -- Sebastiaan

  • Dear @sebastiaan

    Thank you for your help. I have tried the code you gave me. Unfortunately, like before, while the Javascript was able to detect the response time, the logger didn't log what had been detected by the Javascript.

    To make it clearer, here is a screenshot from when I tested the experiment on Chrome, and inspected the elements:

    As it can be seen, the Javascripts were able to detect the time, namely "5588", "7694", and "818714", for the respective "form_text_input" items. However the final results that were recorded by the logger remained to be "null" for all three "form_text_input" items. I think this is unusual, as I have included the "time_[item name]" in the logger, and as can be seen above, the "time_new_inline_javascript" items worked perfectly, while the "time_new_form_text_input" failed to work properly. I have consulted a friend of mine who is experienced in coding, and she too was baffled by it.

    However, since the Javascript could detect the time properly, I am wondering if there is a way to circumvent this problem? For example, could we perhaps directly extract the data from the inline_Javascript items? Or do we have to totally rely on the logger to extract the relevant data?

    If it will help to better illustrate the problem, here is the mock experiment that I have been using in order to solve this issue:

    Thank you so much for your kind help.


    Best Regards,

    Joshua

  • Hi @Joshua_Gabriel ,

    You're storing the response time in a variable called response_time ; however, this variable is not included in the logger . In addition, you're using the same variable (response_time ) three times in a row, but logging it only once at the very end. This means that you will only log the last response time. To fix that, you need to:

    • either use three different variables (response_time1 , response_time2 , response_time3 ) and log them all;
    • or insert a logger after each response.

    Hope that clears things up!

    — Sebastiaan

  • Hi @sebastiaan

    Thank you for your reply. Based on your advices, I have modified my questionnaires, and I believe my problems have been fixed.

    Thank you for your assistance!

    Best Regards,

    Joshua

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