diff --git a/docs/demos/jspsych-cloze-demo3.html b/docs/demos/jspsych-cloze-demo3.html new file mode 100644 index 00000000..f6185044 --- /dev/null +++ b/docs/demos/jspsych-cloze-demo3.html @@ -0,0 +1,31 @@ + + +
+ + + + + + + + + + diff --git a/docs/plugins/cloze.md b/docs/plugins/cloze.md index 9479f13f..1fe9f4ee 100644 --- a/docs/plugins/cloze.md +++ b/docs/plugins/cloze.md @@ -13,6 +13,7 @@ In addition to the [parameters available in all plugins](../overview/plugins.md# | text | string | *undefined* | The cloze text to be displayed. Blanks are indicated by %% signs and automatically replaced by input fields. If there is a correct answer you want the system to check against, it must be typed between the two percentage signs (i.e. % correct solution %). | | button_text | string | OK | Text of the button participants have to press for finishing the cloze test. | | check_answers | boolean | false | Boolean value indicating if the answers given by participants should be compared against a correct solution given in the text (between % signs) after the button was clicked. If ```true```, answers are checked and in case of differences, the ```mistake_fn``` is called. In this case, the trial does not automatically finish. If ```false```, no checks are performed and the trial automatically ends when clicking the button. | +| check_blanks | boolean | false | Boolean value indicating if the answers given by participants should be checked for completion after the button was clicked. If ```true```, answers are checked and in case there are some missing, the ```mistake_fn``` is called. In this case, the trial does not automatically finish. If ```false```, no checks are performed and the trial automatically ends when clicking the button. | | mistake_fn | function | ```function(){}``` | Function called if ```check_answers``` is set to ```true``` and there is a difference between the participants answers and the correct solution provided in the text. | ## Data Generated @@ -63,6 +64,23 @@ import cloze from '@jspsych/plugin-cloze'; Open demo in new tab +???+ example "Cloze example using default settings with completion checking and custom error handling" + === "Code" + ```javascript + var cloze_trial = { + type: jsPsychCloze, + text: 'Science notebooks have a %%-colored front cover. Math notebooks have a %%-colored front cover.', + check_blanks: true, + mistake_fn: function() { alert('Please fill in all blanks.'); } + }; + ``` + === "Demo" +