Howdy, Stranger!

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

Supported by

Disabling "enter" button in form_text_input

Hello,
I have a very basic question but unfortunately, I couldn't manage to make it :( In my experiment, I am using form_text_input. I want my participants to write a memory, which can be long and include many sentences and paragraphs. But in the form, whenever they press the "enter" button the page is changing and the next task appears. As you know pressing the enter is very reflexive in our lives and even if I told them not to press they press :( So is there a possibility to disable this function or at least changing it with any other rarely used button.

Comments

  • Hello again :) Actually I found to disable this function by return_accept option. However I still have one problem about the same issue. In the text input form, I added a "next" button. But the button is not active until the enter pressed. I want my participants whenever they finished writing they are able to click the next button and skip the task. Since my experiment is a bit long, it is hard to inform them " please first press the enter and then click the next button". Is it possible to activate next button starting from the experiment?

  • Hi,

    That is weird. When I add a button to a form, in can be clicked always, no need to press or alike. Are you sure you're doing it correctly? Can you share the code of your form?

    Tjhanks,

    Eduard

  • Hello Eduard,
    Here is my code for text document. It is actually very basic, I just added a button at the end. Even if I give a limited tome for the presentation the situation is not changing.

    set timeout infinite
    set spacing 10
    set rows "1;1;6;1;1"
    set only_render no
    set ok_text Devam
    set margins "50;50;50;50"
    set form_var response
    set form_title Title
    set form_question "haydi evini anlat"
    set cols 1
    set _theme gray
    widget 0 0 1 1 label text="[form_title]"
    widget 0 1 1 1 label center=no text="[form_question]"
    widget 0 2 1 1 text_input focus=yes return_accepts=no stub="" var="[form_var]"
    widget 0 4 1 1 button center=yes frame=yes text="[ok_text]"

  • Hi,

    your code works for me. What version of Opensesame are you using? Which backend? Which operating system? I'm on Ubuntu 16.06, OS 3.2.2 with xpyriment backend.

    Eduard

  • "I want my participants whenever they finished writing they are able to click the next button and skip the task."
    I am facing the same issue. Only after I press enter, I am able to use the button.

  • Hello,
    I am having a similar issue. My experiment contains a form with open text input, which may contain more than one line and when the user presses Enter, they are directed to the next page.
    Solution to moving next page is as Ece told adding "return_accepts=no", but how can I manage to go to the next line.
    When the users want to input more than one line (such as listing some thing), how can I manage it?

  • If it happens that often, it sounds like a bug.

    What version of Opensesame are you using? Which backend? Which operating system?

    Can you provide this information?

    @sebastiaan: Have you seen this before?

    Eduard

  • Hi guys,

    There seem to be a few issues in this discussion.

    The first is that @akca_ece reports needing to press enter to be able to click on the Accept button. This was indeed true with OpenSesame 3.1 and earlier, but as of 3.2 you can use all widgets at the same time; that is, you can click on the accept button without needing to leave the text input. So upgrade!

    The second, pointed out by @newbee , is that you cannot use enter to go to the next line. This is indeed not possible. The only way that I can think of is by monkey-patching the way that the text_input widget handles key presses. You can do this by entering the following script in the Prepare phase of an inline_script at the very beginning of the experiment. This is hacking into the internals of OpenSesame, though, so it might break in future versions!

    Cheers!
    Sebastiaan

    def my_coroutine(self):
    
        self.caret_pos = len(self.text)
        retval = None
        while True:
            d = yield retval
            retval = None
            if d[u'type'] == u'stop':
                break
            if d[u'type'] != u'key':
                continue
            key = d[u'key']
            if not self._key_filter(key):
                continue
            if key == u'space':
                self.text = self.text[:self.caret_pos] + u' ' \
                    + self.text[self.caret_pos:]
                self.caret_pos +=1
            elif key == u'backspace':
                self.text = self.text[:self.caret_pos-1]  \
                    + self.text[self.caret_pos:]
                self.caret_pos = max(0, self.caret_pos-1)
            elif key == u'delete':
                self.text = self.text[:self.caret_pos] \
                    + self.text[self.caret_pos+1:]
            elif key in (u'return', u'enter'):
                if self.return_accepts:
                    retval = self.text
                else:
                    self.text += u'\n'
                    self.caret_pos += 1
            elif key in (u'home', u'page up'):
                self.caret_pos = 0
            elif key in (u'end', u'page down'):
                self.caret_pos = len(self.text)
            elif key == u'left':
                self.caret_pos = max(0, self.caret_pos-1)
            elif key == u'right':
                self.caret_pos = min(len(self.text), self.caret_pos+1)
            elif len(key) == 1:
                self.text = self.text[:self.caret_pos] + key \
                    + self.text[self.caret_pos:]
                self.caret_pos +=1
            self._update()
            self.set_var(self.text)
    
    
    from libopensesame import widgets
    widgets.text_input.coroutine = my_coroutine
    

    Buy Me A Coffee

  • Hello all,
    Thanks @sebastiaan and @eduard,
    The hack worked in my case, I added this script at the beginnning of my experiment in prepare phase.
    And now it is working as desired. When I want participants to write long texts and make lists, hitting Enter takes them to the next line instead of next page (when return_accepts=False).
    My OpenSesame version: 3.2.5

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