changing global variables within on_finish function? #2075
-
Hello, I've declared the string "outcome" globally here, outside of any functions.
I then edit the string using responses from a survey multi choice variable, within the on_finish(data) function:(at the emphasized line with **)
But, when I use the "outcome" string here as the prompt to this keyboard response trial, it registers as "undefined" and shows up
Does anyone know what I'm doing wrong? Any help is appreciated, thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @addisonjadwin, the prompt parameter that uses the outcome variable is defined when the page first loads, at which point |
Beta Was this translation helpful? Give feedback.
Hi @addisonjadwin, the prompt parameter that uses the outcome variable is defined when the page first loads, at which point
outcome
is undefined. So I think all you need to do is turn that prompt parameter into a dynamic parameter (function). That way the parameter value is defined during the experiment. Does that work?