Reply To: log global vs. local variable

PennController for IBEX Forums Support log global vs. local variable Reply To: log global vs. local variable

#6318
Jeremy
Keymaster

Hello,

You have a problem with the parentheses of your first trial: all your newVar blocks are inside the wait command of the Button, and all your .log(...,getVar(...)) are attached to the closing bracket of that wait command, when they should be attached to the closing parenthesis of newTrial:

newTrial( "Angaben" , 
    newText("Ueberschrift", "<h2>Stichproben-relevante Angaben</h2>").center().print()
    ,
    newTextInput("inputAlter").size("100px")
    ,
    newScale("inputGeschlecht", "männlich", "weiblich", "divers")
    ,
    newScale("inputHaendigkeit", "linkshändig", "rechtshändig")
    ,
    newTextInput("inputGeboren")
    ,
    newTextInput("inputWohnsitz")
    ,
    newScale("inputDeutsch", "ja", "nein")
    ,
    newTextInput("inputMuttersprache")
    ,
    newTextInput("inputProlific-ID")
    ,
    newCanvas("Canvas", 600, 320)
        .add( 0,     0, newText("Alter:"))
        .add( 400,   0, getTextInput("inputAlter").log())
        .add( 0,    40, newText("Geschlecht:"))
        .add( 400,  40, getScale("inputGeschlecht").log())
        .add( 0,    80, newText("Händigkeit"))
        .add( 400,  80, getScale("inputHaendigkeit").log())
        .add( 0,   120, newText("Geboren in (Bundesland/Staat):"))
        .add( 400, 120, getTextInput("inputGeboren").log())
        .add( 0,   160, newText("Derzeitiger Wohnsitz (Bundesland/Staat):"))
        .add( 400, 160, getTextInput("inputWohnsitz").log())
        .add( 0,   200, newText("Deutsch als Muttersprache?"))
        .add( 400, 200, getScale("inputDeutsch").log())
        .add( 0,   240, newText("Muttersprachen (außer Deutsch):"))
        .add( 400, 240, getTextInput("inputMuttersprache").log())
        .add( 0,   280, newText("Prolific-ID:"))
        .add( 400, 280, getTextInput("inputProlific-ID").log())
        .print()
    ,
    newText("Warnung1", "Bitte füllen Sie die Pflichtangaben aus.")
        .color("red")
        .italic()
        .center()
        .hidden()
        .print()
    ,
    newButton("Weiter") 
        .center()
        .print()
        .wait( getTextInput("inputAlter").test.text(/.+/)
            .and(getTextInput("inputGeboren").test.text(/.+/))
            .and(getTextInput("inputWohnsitz").test.text(/.+/))
            .and(getTextInput("inputProlific-ID").test.text(/.+/))
            .and(getScale("inputGeschlecht").test.selected())
            .and(getScale("inputHaendigkeit").test.selected())
            .and(getScale("inputDeutsch").test.selected())
            .failure( 
                getText("Warnung1").hidden()
                ,
                newTimer(100).start().wait()
                ,
                getText("Warnung1").visible() 
            )
        )
    ,
    newVar("Alter").global().set( getTextInput("inputAlter") )
    ,
    newVar("Geboren").global().set( getTextInput("inputGeboren") )
    ,
    newVar("Wohnsitz").global().set( getTextInput("inputWohnsitz") )
    ,
    newVar("Muttersprache").global().set( getTextInput("inputMuttersprache") )
    ,
    newVar("Prolific-ID").global().set( getTextInput("inputProlific-ID") )
        ,
    newVar("Geschlecht").global().set( getScale("inputGeschlecht") )
    ,
    newVar("Haendigkeit").global().set( getScale("inputHaendigkeit") )
    ,
    newVar("Deutsch").global().set( getScale("inputDeutsch") )
)
.log("Alter", getVar("Alter"))
.log("Geschlecht", getVar("Geschlecht"))
.log("Haendigkeit", getVar("Haendigkeit"))
.log("Geboren", getVar("Geboren"))
.log("Wohnsitz", getVar("Wohnsitz"))
.log("Deutsch", getVar("Deutsch"))
.log("Muttersprache", getVar("Muttersprache"))
.log("Prolific-ID", getVar("Prolific-ID"))
.setOption("countsForProgressBar", false)
.setOption("hideProgressBar", true)

Jeremy