Skip to content
Discussion options

You must be logged in to vote

Hi @rbruno1, there are two issues here. First, the compareKeys function is just meant for checking whether two keyboard key presses are the same, so I wouldn't use that function to compare two text responses. Second, to access the participant's response in the on_finish function, you'll need to use data.response.Q0, because data.response is an object that contains key/value pairs for each question, and you're trying to access the response to the first (only) question, which is automatically called "Q0".

So try this in your trial's on_finish function:

data.correct = data.response.Q0 == data.correct_response;

And here's another tip: JavaScript has the toLowerCase function for converting str…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rbruno1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants