Howdy, Stranger!

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

Supported by

Next Button doesn't work and using Input for Feedback

edited December 2017 in OpenSesame

Hey there!!
1) My Next Button doesn't work. It only works if I don't answer the question which is on the same form.- Counterproductive :blush: :

2) I want to use my answer collected by the form to give feedback and use it all troughout the experiment. I put the variable name of the textinput [text_input] in a feedback Item after my form but it doesnt show anything.

I used 2 Inlinescripts and one feedback_item where I wrote [text_input], in that order.

First Inlinescript:

    import random
    import numpy as np
    from numpy import random as nprand

    def create_matrix():
      # determine the random number of ones and zeros to be put into the lists
      c0_min = 20 # minimal number of zeros
      c0_var = 5 # range of possible additional zeros
      c0 = int(nprand.rand()*c0_var + c0_min) # count of zeros

      c1_min = 20 # ones
      c1_var = 20 
      c1 = int(nprand.rand()*c1_var + c1_min) # count of zeros

      # construct a long list with ones and zeros of random order
      # items
      items = [0,]*c0 + [1,]*c1
      random.shuffle(items)

      # determine the length of the rows 1-4
      # there is a minimal length + a variable length
      # len of rows
      lmin = 10
      rowcount = 4
      spacemax = 5

      # determine the number of characters that are freely assignable (total number minus minimal length)
      l_temp = c0+c1-lmin*rowcount # variable assignable characters

      # divide residual characters with respect to random weights among the rows
      l_weights = nprand.rand(4)
      l_weights = l_temp*l_weights/sum(l_weights)
      s_count = nprand.randint(0,spacemax,4)

      # calculate the final lengths of the rows
      r1 = lmin + int(l_weights[0])
      r2 = lmin + int(l_weights[1])
      r3 = lmin + int(l_weights[2])
      r4 = lmin + int(l_weights[3])

      # construct the strings by iterating the previously shuffled character list
      s1 = ''.join([str(i) for i in [' ', ]*s_count[0] + items[:r1]]) + "\n"
      s2 = ''.join([str(i) for i in [' ', ]*s_count[1] +  items[r1:(r1+r2)]]) + "\n"
      s3 = ''.join([str(i) for i in [' ', ]*s_count[2] +  items[(r1+r2):(r1+r2+r3)]]) + "\n"
      s4 = ''.join([str(i) for i in [' ', ]*s_count[3] +  items[(r1+r2+r3):]])

      # return row 1-4, number of zeros, number of ones.
      return {"rows": s1+s2+s3+s4, "c0":c0, "c1":c1}

    m = create_matrix()
    print m["rows"]
    var.grid = m["rows"]
    # this is mockup code
    tmarker = 10
    timer = 5
    print m['c0']

    var.kbresponse = int()
    # end of mockup code
    var.h = str(m["c0"])
    #m["c0"] = count zero,..

** Second Inlinescript:**

    from libopensesame import widgets
    form = widgets.form(exp, cols=[1,1], rows=[1,1,1,1,1])
    title = widgets.label(form,
        text='Indicate how much you agree with the following statement')
    question1 = widgets.label(form, text=var.grid, center=False)

    nextButton = widgets.button(form, text='Next')
    form.set_widget(title, (0,0), colspan=2)
    form.set_widget(question1, (0,0))

    form.set_widget(nextButton, (0,4), colspan=2)
    form._exec


    var.text_input = widgets.text_input(form, text="Wieviele Nullen befinden sich in dem Zahlenblock:", var='response',
            return_accepts=True)
    form.set_widget(var.text_input, (0,3))
    form._exec()

Any pointers would be great!!!

Comments

  • Hi,

    Attached the modified experiment that should work.

    1) My Next Button doesn't work. It only works if I don't answer the question which is on the same form.- Counterproductive :blush: :smile:

    This is because you have activated the option return_accept = True. In order to proceed, you have to hit return. If you set return_accept to False, then you have to press the next button in order to proceed.

    2) I want to use my answer collected by the form to give feedback and use it all troughout the experiment. I put the variable name of the textinput [text_input] in a feedback Item after my form but it doesnt show anything.

    Not sure what went wrong in your case, but in the attached example, it does work. So if you set var = 'Response', then you can call the the variable with var.Response, or [Response] henceforth.

    Hope this helps.

    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