-
Hello, I am using the cloze plugin to set up a cloze test experiment. Instead of checking the participant's answer to a preset answer, I want participants not to be able to continue to the next trial until they have given an answer. I tried copying the required answer code from the survey-text plugin into the cloze-plugin to no success. Any input would be highly appreciated! (it is my first time using JsPych and it has been very useful) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi @LizSmeets, I don't think the cloze plugin supports that feature right now. I'll mark the issue you opened as a feature request. One thing you could do is modify the plugin code. Here's the relevant section: jsPsych/packages/plugin-cloze/src/index.ts Lines 74 to 82 in 5b1a967 Changing the statement |
Beta Was this translation helpful? Give feedback.
-
Hi @LizSmeets, My previous answer was missing the fact that if the answer is an empty string then the only accepted input will also be an empty string. I've modified the plugin like this now: if (answers[i] == "" || (answers[i] !== solutions[i] && solutions[i] !== "")) {
field.style.color = "red";
answers_correct = false;
} This makes sure to only check the validity of an answer if there is an answer to check against. I tested this and it works. You can try the demo here. |
Beta Was this translation helpful? Give feedback.
Hi @LizSmeets,
My previous answer was missing the fact that if the answer is an empty string then the only accepted input will also be an empty string. I've modified the plugin like this now:
This makes sure to only check the validity of an answer if there is an answer to check against.
I tested this and it works. You can try the demo here.