Reply To: Questionnaire with questions on the same page

PennController for IBEX Forums Support Questionnaire with questions on the same page Reply To: Questionnaire with questions on the same page


Hi Daniela,

I would need more detail about the whole setup of your experiment, but here is an example that picks names from a table and shows them all in a single trial in a random order:

AddTable("myTable", `name,presented

var names = [];
var test;
function handleNames(row){
    if ("__"){
        names = names.sort(v=>Math.random()>=0.5);
        return newTrial(
   r => {
                test = test || newFunction(v=>true);
                test = test.and( getScale('-scale-'+r.presented).test.selected() );
                return newText(": ")
                        newScale('-scale-'+r.presented, 5)
                            .before( newText(" I'm sure I NEVER saw this name ") )
                            .after( newText(" I'm sure I DID see this name") )
                .wait( test )
    return [];

Template( "myTable", row => handleNames(row) )

I inserted the value of presented in the name of the Scale so you can retrieve the value from the results file, but I think it would be cleaner to just log the Scale score in the results file and add presented back to it from your input table when you analyze your results (in R, for example). If you have the option of defining an array in a js file rather than looking up a CSV table, as in Andrea’s case, I would do that instead, you wouldn’t need all these tricks like adding a row with __ in name.

I also had to use a trick to make sure “Send” would only proceed if all Scale elements are selected.