PennController.SendResultsGlobal Commands

PennController.SendResults() (since PennController 1.1)

or PennController.SendResults( "label" ) (since PennController 1.1)

Since PennController 1.7, SendResults can be used in three different environments:

  1. On its own, it creates a trial whose sole function will be to send the results to the server when it is run. You can give a label to the trial by passing a string as an argument to SendResults and then refer to it in Sequence in order to send the results early.
  2. Alternatively, you can use it directly inside Sequence in place of a reference to a label, with the same effect as above (but lifting the need to come up with a dedicated label)
  3. SendResults() can also be used as a command inside a trial: when it is run, it will send the results to the server. This is useful if you want to allow your participants to send their results early for some reason.

Sending the results early is useful if you want your participants to see a confirmation screen at the end.

Examples:

Sequence( "hello" , "world" , SendResults() , "bye" )

newTrial( "hello" ,
    newButton("Hello")
        .settings.log()
        .print()
        .wait()
)
newTrial( "world" ,
    newButton("Send & quit now")
        .settings.callback( 
            getButton("World")
                .remove()
            ,
            SendResults()
        )
        .print( 10 , 10 )
    ,
    newButton("World")
        .settings.log()
        .print()
        .wait()
)

newTrial( "bye" ,
    newText("thanks", "Thank your for participating in this experiment.")
        .print()
    ,
    newText("link", "<a href='.'>Click here to confirm your participation.</a>")
        .print()
    ,
    newTimer("forever", 1)
        .wait()            // Timer never started: will wait forever
)
.setOption("countsForProgressBar",false)

Through the Try-it interface, the Send & quit now button will crash because the experiment is not run globally but instead from within the test page.