Howdy, Stranger!

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

Supported by

[solved] Questionnaire issues

edited September 2014 in OpenSesame

Hi I am having trouble with some parts of a questionnaire
I want through opensesame to have the following:
if one presses the "next" button without having checked one or more of the available checkboxes to warn the user and not let him/her continue

and on another note

how can i control one of the checkboxes? e.g. if i have 6 checkboxes in a question, the user can select any one the five (one or more) except for one checkbox the 6th one...if that is selected it cannot select any of the others and has to press "next" for the next question....

Thanks ahead of time for the help

Comments

  • edited 11:38AM

    You can find a very useful discussion about about validating form input here:

    Essentially, to validate form input, you will need to implement some checks in an inline_script and, if necessary, run the form until your criteria are met. Forms don't have any built-in validation functionality, so -- to answer your second question -- you cannot disallow participants from checking too many checkboxes. However, you can check afterwards whether participants have checked too many checkboxes, and, if so, execute the form again.

    I cannot say anything more specific, because you would need to provide more details about the implementation of your experiment.

    Cheers!
    Sebastiaan

  • edited September 2014

    Thanks for your response

    So for example in the partial script below (which is modification of your questionnaire demo) I want to NOT allow participants to move to the next question unless at least one checkbox has been clicked...as in the consent form...the code below

    # Generated by OpenSesame 2.8.3 (Gutsy Gibson)
    # Wed Sep 10 19:29:22 2014 (nt)
    # <http://www.cogsci.nl/opensesame>
    
    set mouse_backend "legacy"
    set subject_parity "even"
    set height "768"
    set font_family "mono"
    set font_italic "no"
    set synth_backend "legacy"
    set title "Questionnaire"
    set coordinates "relative"
    set start "experiment"
    set sampler_backend "legacy"
    set transparent_variables "no"
    set foreground "white"
    set font_bold "no"
    set description "Default description"
    set background "black"
    set decline_message "You need to accept the consent form to participate!"
    set font_size "18"
    set keyboard_backend "legacy"
    set canvas_backend "legacy"
    set compensation "0"
    set bidi "no"
    set subject_nr "0"
    set width "1024"
    
    define form_consent Consent
        set accept_text "Συνεχίζω!"
        set rows "1;4;1;1"
        set description "A simple consent form"
        set checkbox_text "Έχω καταλάβει την διαδικασία και επιθυμώ να συνεχίσω."
        __form_text__
        Το πείραμα θα αρχίσει με κάποια δημογραφικά στοιχεία και στη συνέχεια με την συσχέτιση χειρονομιών με κάποιες λέξεις που αναφέρονται σε ένα Χ αντικείμενο.
    
        Είναι απαραίτητο να είστε ακριβείς και γι' αυτό το λόγο δεν υπάρχει χρονικός περιορισμός στις επιλογές σας.
    
        Στο τέλος του πειράματος θα σας εξηγήσουμε τι ακριβώς μελετάμε. 
    
    
        Ευχαριστούμε για την συμμετοχή σας!
        __end__
        set form_title "<span size=24>Πειραματίσου μαζί μας!</span>"
        set decline_text "Όχι, ευχαριστώ"
        set decline_message "You need to accept the consent form to participate!"
        widget 0 0 2 1 label text="[form_title]"
        widget 0 1 2 1 label center="no" text="[form_text]"
        widget 0 2 2 1 checkbox var="checkbox_status" text="[checkbox_text]"
        widget 0 3 1 1 button var="accept_status" text="[accept_text]"
        widget 1 3 1 1 button text="[decline_text]"
    
    
    define form_base Demographics
        set rows "1;1;1;1;1"
        set cols "1;1;1;1"
        widget 0 0 4 1 label text="<b>Μερικά απαραίτητα στοιχεία...</b>"
        widget 0 1 1 1 label center="no" text="Φύλλο"
        widget 1 1 1 1 checkbox group="gender" text="Γυναίκα" var="response_gender1"
        widget 2 1 1 1 checkbox group="gender" text="Άνδρας" var="response_gender1"
        widget 0 2 1 1 label center="no" text="Ελληνική γλώσσα"
        widget 1 2 1 1 checkbox group="language" text="Μητρική" var="response_language1"
        widget 2 2 1 1 checkbox group="language" text="Μη μητρική" var="response_language1"
        widget 0 3 1 1 label center="no" text="Ηλικία"
        widget 1 3 3 1 text_input var="response_age1"
        widget 0 4 4 1 button text="Οκ!"
    
  • edited 11:38AM

    I want to NOT allow participants to move to the next question unless at least one checkbox has been clicked...as in the consent form...the code below

    Right, so that's what the discussion I linked to above is all about :p. See especially this comment:

  • edited September 2014

    okay last message i hope...
    i did look at the previous messages and played with the sample code but i am still having trouble. So i modified the code for the rating scale for checkbox while maintaining all other code intact but i still have a problem....that is, you can leave the checkbox unchecked and it will still go on to the next trial....what am i missing?

    Code below:

    set mouse_backend "legacy"
    set subject_parity "even"
    set response2 ""
    set height "768"
    set sound_buf_size "512"
    set font_italic "no"
    set custom_cursor "yes"
    set synth_backend "legacy"
    set title "Example for Sylvia"
    set coordinates "relative"
    set start "experiment"
    set sampler_backend "legacy"
    set font_family "mono"
    set foreground "white"
    set font_bold "no"
    set description "In this example it is checked whether the text input is an integer between 0 and 100."
    set background "black"
    set font_size "18"
    set keyboard_backend "legacy"
    set canvas_backend "legacy"
    set compensation "0"
    set subject_nr "0"
    set width "1024"
    
    define inline_script create_form
        ___run__
        from libopensesame import widgets
    
        form = widgets.form(self.experiment, cols=[3,2], rows=[1,1,1,1,1,1,1,1], spacing = 10)
        titel = widgets.label(form,  text='Ongezond snacken is iets...', center=False)
        vraag1 = widgets.label(form,  text='1. dat ik regelmatig doe', center=False)
    
        instructie= widgets.label(form, text='1 = helemaal oneens, 7 = helemaal eens')
    
        ratingScale1 = widgets.checkbox(form, var='ongezond_SRHI_item1')
    
        nextButton = widgets.button(form, text='Verder')
    
        form.set_widget(titel, (0,0), colspan=1)
        form.set_widget(vraag1, (0,1))
    
        form.set_widget(instructie, (1,0))
        form.set_widget(ratingScale1, (1,1))
    
        form.set_widget(nextButton, (0,7), colspan=2)
        form._exec()
        __end__
        set _prepare ""
        set description "Executes Python code"
    
    define sequence experiment
        run warning_message "never"
        run create_form "never"
        run inline_script "always"
    
    define inline_script inline_script
        ___run__
        while True:
    
            incomplete = False
    
            exp.items["create_form"].run()
    
            if (self.get("ongezond_SRHI_item1") == "None" 
                ):
                incomplete = True
    
            if not incomplete:
                    break
    
            else:
                exp.items["warning_message"].prepare()
                exp.items["warning_message"].run()
    
        __end__
        set _prepare ""
        set description "Executes Python code"
    define sketchpad warning_message
        set duration "1000"
        set description "Displays stimuli"
        draw textline 0 0 "You didn't answer all the questions..." center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always" html="yes"
    
  • edited 11:38AM

    Hi,

    You're very very close. The problem was that an unchecked checkbox sets its response variable to 'no', and not to 'None'. This explained in more detail here:

    So the script below should do the trick. For future reference, you don't need to implement the form in an inline_script (although you can). You can also implement the form using a form_base plug-in, and only use an inline_script for the checking part.

    Cheers!
    Sebastiaan

    while True:
        incomplete = False
        exp.items["create_form"].run()
        print self.get("ongezond_SRHI_item1")
        if self.get("ongezond_SRHI_item1") == "no":
            incomplete = True
        if not incomplete:
                break
        else:
            exp.items["warning_message"].prepare()
            exp.items["warning_message"].run()
    
  • edited 11:38AM

    I created an experiment that runs perfectly on a MacBook Pro (OS X; OpenSesame 0.27.4). However, when I try to open the experiment file on my testing machine - a PC (running OpenSesame 2.8.2) - it gives an error message that reads: Unexpected error: exception message. Exception type: WindowsError

  • edited 11:38AM

    Hi Scarlett,

    As a first step, you could upgrade to OpenSesame 2.9.0. However, in case this doesn't resolve the issue: Do you see additional output in the debug window? And/ or do you see a opensesame.exe.log file in the OpenSesame folder? If so, please post!

    Cheers,
    Sebastiaan

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