Howdy, Stranger!

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

Supported by

[open] Restrict moving on to next item

edited July 2015 in OpenSesame

Currently, I have a form that displays a word on the left of the screen and a box on the right for a subject to type an associated word. I accomplish this with the widgets and the code below, which are part of a loop.

set cols "1;1;1;1;1;1"

set form_question ""

set form_var "keyboard_response"

set rows "1;1;1;1;1;1;1;1;1"

widget 2 4 1 1 label center="yes" text="[word]"

widget 3 4 1 1 text_input focus="yes" stub=" " return_accepts="yes" var="[form_var]"

Currently, my experiment runs fine, but, if the box is left blank and I press ENTER, the experiment moves on to the next item.

What I would like to do is stipulate that a subject cannot just press ENTER to move on to the next item until she types something in the box. I don't want a subject to accidentally press ENTER and lose the chance to type anything. I tried inserting a keyboard_response, but that requires the subject to press ENTER twice to move on; once for (presumably) return_accepts and once for the keyboard response. I only want the subject to have to press ENTER once to move on (i.e., she should type the associated word, press enter once, and then the loop should move to the next pair).

Does anyone know how I can code this, or is there something I can do with keyboard_response to accomplish what I am trying to do?

Comments

  • edited 3:37PM

    Hi random number,

    I think it would be best to place your form item in (a sequence item in) a loop item. The idea is to repeatedly run the form as long as participants haven't provided an answer.

    Clicking on the loop item, you can check the "advanced options" box to reveal a break-if command. Here you can insert a command along the lines of "response != '' " (resulting in: break if response is not nothing). It may also be desirable to add a warning message if participants haven't filled in anything. To realize this, you would have to place a second form in the sequence, that is only run (you can indicate a run-if statement) if the first form wasn't answered correctly. The second copy would be identical to the first, with the addition of a warning message. (If you want to implement this, make sure that the first form isn't run again if the second form is run! It requires some logic but it's do-able; let me know if you need help with this).

    Good luck,
    Cheers,

    Josh

  • edited 3:37PM

    Currently, I have a loop which contains a sequence. That sequence contains the variable "word" (my list of words that appear as the subject presses ENTER) and the widgets.

    When I type keyboard_response != "" in the advanced options, I get this error message: Failed to compile conditional statement "keyboard_response != ": 'keyboard_response != ' is not a valid conditional statement in sequence item '__NV'

    I tried typing "not self.has('keyboard_response')" (without "" of course) in that space in advanced options, and I get
    Unexpected error
    line: 1
    exception message: 'unicode' object is not callable
    exception type: TypeError

    Traceback (also in debug window):
    File "dist\libqtopensesame\misc\process.py", line 139, in run
    File "dist\libopensesame\experiment.py", line 347, in run
    File "dist\libopensesame\sequence.py", line 47, in run
    File "dist\libopensesame\loop.py", line 136, in run
    File "", line 1, in
    TypeError: 'unicode' object is not callable

  • edited 3:37PM

    Can I add a keyboard_response item and say

    Correct response: None

    Allowed responses: All

    and then make the widget not require ENTER to move on because the keyboard_response item will move the experiment along?

  • edited 3:37PM

    Hi,

    When I type keyboard_response != "" in the advanced options

    Without having tested it I suspect that "" is not equal to " ". Don' forget to include a character in between the quotation marks.

    Regarding your second question, I don't think what you'll have in your mind will solve the issue. Josh's solution is the one I'd recommend as well. So, wrap another sequence around your word item and set its no. of repeats to a very high number. Additionally, you have to define a break statement that will cause the loop to stop and proceed with the other widgets.

    Good luck,

    Eduard

    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