Howdy, Stranger!

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

Supported by

jsPsych Study with Abort Button

Hi all,

I want to add a Cancel button to my jsPsych study. When using the methods described here, it works fine. However, I would like to use the jatos.addAbortButton() function to reduce the code (it also looks nicer and prompts the do you really want to quit question). I have tried numerous ways to include it in the jsPsych study, but none of it seems to work.

Can someone give advice on where/how to use jatos.addAbortButton() in a jsPsych study?

Thanks in advance!

Comments

  • Hi,

    You can basically put this jatos.addAbortButton() anywhere where code is executed. So right next to where you call jatos.onLoad should do fine.

    jatos.addAbortButton();
    
    jatos.onLoad(function() {
      jsPsych.init( {
        // ...
      });
    });
    

    Best,

    Kristian

    Buy Me A Coffee

  • Strange -- I tried to do exactly that (for starters, I just added this to the go/nogo example from the JATOS example studies), but I don't see any abort button (neither in my local JATOS or if I export it to an online instance of it). Any ideas of what I might be missing?

    jatos.addAbortButton();
    
    
    /* start the experiment */
    jatos.onLoad(function () {
         jsPsych.init({
              timeline: timeline,			
    	  on_finish: function() {
              var resultJson = jsPsych.data.get().json();
                    jatos.submitResultData(resultJson, jatos.startNextComponent);
                }
        });
    


    Thanks,

    Tobias

  • Hi Tobias,

    You seem to be right. I just tried the jatos.addAbortButton with jsPsych and it was not added. Somehow jsPsych seems to prevent adding of new elements to the DOM. Weird. I have to have a closer look at this.

    Best,

    Kristian

    Buy Me A Coffee

  • I also tried adding it using the on_load command for separate elements of the jspsych study but this also did not work, for instance:

    var welcome = {
            type: "html-keyboard-response",
            on_load: jatos.addAbortButton(),
    	stimulus: "Welcome to the experiment. Press any key to begin."
        };
        timeline.push(welcome);
    

    (just wanted to let you know in case this helps)

  • It actually helped :). Just not the on_load but the on_trial_start callback function. But this is not the only thing - I had to change jatos.js a bit this will only be part of the next release 3.5.5. (should come out in a couple days). The problem with jsPsych is that each trial seems to clear the whole body element. That means that the abort button has to be added each trial anew.

    But then you can get an abort button in jsPsych with something like this:

    jsPsych.init({
                timeline: timeline,
                on_trial_start: jatos.addAbortButton,
                ...
    

    Best,

    Kristian

    Buy Me A Coffee

  • Hi Kristian,

    somehow missed your response but this looks perfect! Looking forward to the new release (and not having to manually implement an abort button in every timeline element :)

    Cheers,

    Tobias

  • Hi Tobias,

    yes, I miss messages here too although I'm subscribed. Sometimes I just don't get the email. Luckily this happens seldom.

    Release will come out in a couple days. We are still testing. There are a couple other jatos.js changes and changes in jatos.js are always delicate.

    Best,

    Kristian

    Buy Me A Coffee

  • Hi Kristian,

    I just downloaded the latest version of JATOS and tried again with the addAbortButton command, but can't get it to work for some reason. I've seen that there has been a commit on Github which seems to implement that change -- is it just not embedded within the downloadable version of Jatos yet? I am just wondering whether I am missing something / doing something wrong.

    Best,

    Tobias

  • Hi Tobias,

    I just tried and it worked with my jsPsych study. Maybe there is something in jsPsych that I don't really understand. I put this block in my code:

      jatos.onLoad(function() {
        jsPsych.init({
          timeline: timeline,
          on_trial_start: jatos.addAbortButton,
          on_finish: function() {
            /* Changed for JATOS: submit result data to JATOS and start next component */
            var resultJson = JSON.stringify(jsPsych.data.getData());
            jatos.submitResultData(resultJson, jatos.startNextComponent);
          }
        });
      });
    

    Best,

    Kristian

    Buy Me A Coffee

  • Hi Kristian,

    ah, I see. I did not add the on_trial_start command but now it works fine. Thanks a lot!

    Tobias

  • Nice!

    Buy Me A Coffee

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