Gapfill
Versions
Current version
2.31 (2026040300)
2.31
Plugin type: Question types
Frankenstyle component name: qtype_gapfill
Version build number: 2026040300
Version release name: 2.31
Maturity: Stable
Supported Moodle versions: 4.5, 5.0, 5.1, 5.2
Repository URL (Git): https://github.com/marcusgreen/moodle-qtype_gapfill
Repository branch:
Repository tag: v2.31
Issue/bug tracker URL: https://github.com/marcusgreen/moodle-qtype_gapfill/issues
Version 2.31 of the Moodle Gapfill question type April 2026
Confirmed compatibility with Moodle 5.2
Minor tweak to behat to run with Moodle 5.2
Version 2.3 of the Moodle Gapfill question type Feb 2026
Ensure the Gap settings button can only ever appear when the user
editor preference is set to either Tiny or Atto.
Version 2.2 of the Moodle Gapfill question type Jan 2026
Thanks to Adam Jenkins for a CSS reversion Fix.
https://github.com/marcusgreen/moodle-qtype_gapfill/pull/131
Linting of CSS
Version 2.15 of the Moodle Gapfill question type Dec 2025
Thanks to Dragos and Alistair from UCL for help with helping with fix
to allow per gap feedback to be added with the default TinyMCE
editor.https://github.com/marcusgreen/moodle-qtype_gapfill/issues/128
Fixed issue where if dropdowns were selected each one had a carriage return
after it. Thanks to Andrew Obermeier for reporting
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/130
Fixed in CSS.
Version 2.144 of the Moodle Gapfill question type Oct 2025
Moodle 5.1 compatibility confirmed by running automated tests.
Belated thanks to Diego Corti for reporting this issue https://github.com/marcusgreen/moodle-qtype_gapfill/issues/111
Assorted mass linting using phpcs (no functional changes).
Version 2.143 of the Moodle Gapfill question type May 2025
Moodle 5 compatibility confirmed by running automated tests.
Thanks to Tim Lock https://github.com/tlock of https://www.openlms.net/ for the following.
Fix for issue https://github.com/marcusgreen/moodle-qtype_gapfill/issues/119
Restore of mbz files now ensures that questions are not duplicated as documented
https://moodledev.io/docs/5.0/apis/plugintypes/qtype/restore
Version 2.142 of the Moodle Gapfill question type March 2025
Fixed a bug in backup and restore where the feedback fields were not being backed up.
Thanks to Mark Johnson for reporting this.
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/117
Version 2.141 of the Moodle Gapfill question type October 2024
PHP 8.3 compatibility fix. It was throwing an undeclared variables error
Thanks to to Alistair Spark for reporting the issue here
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/113
Confirmation of compatibility with Moodle 4.5
Version 2.139 of the Moodle Gapfill question type April 2024
Fixes for PHP 8.2 deprecation messages. Updates to ci to confirm compatibility
with Moodle 4.4.
Version 2.138 of the Moodle Gapfill question type May 2023
Fix for PHP 8.1 deprecation messages. Thanks to Joseph Rézeau for
creating the ticket for that.
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/104
Re-instate the creation of letterhints field in the db for upgrades from
before v1.97 (in 2018). Thanks to Dr. Lucia Liljegren for creating the ticket for
that https://github.com/marcusgreen/moodle-qtype_gapfill/issues/105
Version 2.137 of the Moodle Gapfill question type April 2023
Fix compatibility on mobile with dark theme (css tweak)
https://github.com/marcusgreen/moodle-qtype_gapfill/pull/100
Centre droptarget text to better handle long answers
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/99
Additional English language sample questions.
Version 2.136 of the Moodle Gapfill question type Nov 2022
Remove html comments from code before rendering. There is no reason to include comments at run time and when people copy and paste from other sources it can include items like <!--[if !supportLists]
creating spurious gaps. Thanks to sunnac for reporting this.
New behat test to confirm core mlang and mlang2 filters work as expected.
Additional English language sample questions.
Version 2.135 of the Moodle Gapfill question type Sept 2022
The use of jQuery UI broke the display of the 'dock' in Moodle 4.0 https://github.com/marcusgreen/moodle-qtype_gapfill/issues/83. Thanks to Vitaliy Baran for reporting that. Switched to using ES6/HTML5 drag and drop code.
More English language example questions
Version 2.134 of the Moodle Gapfill question type Jun 2022
Fix for duplicated draggables when used in the mobile apps. Thanks to Nicholas Stefanski for reporting this and for contributing a code solution.
Added $CFG->wwwwroot in front of path to mobile css for where moodle home hangs of a folder from the
url.
Version 2.133 of the Moodle Gapfill question type Mar 2022
Missing space around or in non English feedback. Where the language was not
English and there is more than one correct answer the space was missing around
the tanslation of or. So in German if the correct answers are red or green it would present as
redodergreen instead of red oder green. My thanks to Simon Küpfer for reporting this issue.
Described here
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/80
Fix renderer.php so the output complies with the validator at https://validator.w3.org/
My thanks to t-schroeder for raising this issue
https://github.com/marcusgreen/moodle-qtype_gapfill/pull/77
Which gave me the idea of validating the output.
Fix for layout in optionsaftertext mode
Bump to version of Moodle required from 3.3 to 3.7, to make support easier
Updates to behat tests to work with Moodle 4.0. No further support for
MS IE browser 11.
Version 2.132 of the Moodle Gapfill question type Jul 2021
Fix for https://github.com/marcusgreen/moodle-qtype_gapfill/issues/76
where spurious div broke display of quiz blocks.
My thanks to Serge Fleussu for reporting this.
Version 2.131 of the Moodle Gapfill question type June 2021
Fix for Mobile App/ionic5, long text questions were cutting off instead of wrapping.
More english language example questions. Moved from travis ci to github actions and
moodle-ci
Version 2.12 of the Moodle Gapfill question type May 2021
Fix for iOS (e.g. iPads/iPhones). My thanks to Deny Supanji for reporting this. The text entry field now has the spellchecker = false which stops it changing apostrophes into right quote marks.
Refactored get attributes into separate function for clarity in renderer.php (a developer thing)
Adapted to support ionic5 for the mobile app while keeping backwards compatibility for ionic3. See https://docs.moodle.org/dev/Adapt_your_Mobile_plugins_to_Ionic_5
Version 2.11 of the Moodle Gapfill question type Jan 2021
Fix for https://github.com/marcusgreen/moodle-qtype_gapfill/issues/64.
CSS change to fix issue with dropping onto targets. My thanks to
Tim Schroeder for reporting this.
Fix for duplicate draggbles appearing when using the or (|), opertor. As described here
https://moodle.org/mod/forum/discuss.php?d=414949&parent=1672515
My thanks to Nancy Chan for reporting that.
Disable regex in dropdown mode. This is a fix for this issue
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/32
Error in English lang string. Thanks to lucaboesch
https://github.com/marcusgreen/moodle-qtype_gapfill/pull/69
More unit tests in response to coverage reports (purely for developers)
Version 2.10 of the Moodle Gapfill question type Oct 2020
Removed an end_div tag because it broke the display of blocks in quiz.
My thanks to Eliot Hoving of the UCL University in the UK for reporting this.
Version 2.09 of the Moodle Gapfill question type Sep 2020
Singleuse draggbles was always on because javascript interpreted "0" as true.
The file renderer.php now casts it to Boolean (true or false) so singleuse draggables
is only on when the setting is clicked. My thanks to Mrs Summers for reporting this
and helping to identify where the problem was and also to Matthias Giger for testing.
Version 2.08 of the Moodle Gapfill question type Sep 2020
Removed missing nullable parameter type ?int, as it breaks on PHP 7.0 which is supported at least
up till Moodle 3.5. The optionsaftertext setting did not work on Mobile, fixed by adding
a missing a closing div tag . Discarded the code in upgrade.php that changed default datatype of singleuse. It would have applied to a tiny number of users and not actually break anything.
Version 2.07 of the Moodle Gapfill question type Sep 2020
Discard changes to mobile that were supposed to make singleuse work, they broke how it worked on mobile. Added class to put space under answeroptions in
mobile.
Version 2.06 of the Moodle Gapfill question type Aug 2020
New setting singleuse. Draggables are removed from the list of options once they are dropped into a gap. Set on and off through a "singleuse" checkbox in the editing form.
Also works in mobile app.
Added a new feature for possible future that when an item is dropped into a gap the gap has the 'dropped' class added. I may use this in the future for styling, i.e. change appearance on drop.
Double click on a gap with text will clear it now.
Added js logic to the Display answers checkboxes. For example, if dropdowns is selected the Singleuse checkbox is unchecked and disabled. Have not applied logic to the checkboxes under 'show more'
Refined the unit test classes to consolidate create_question and create_question2 into a single function. This is just for developer clarity.
Version 1.979 of the Moodle Gapfill question type June 2020
Filters were not being processed. LayTex in particular. Thanks to Elena Safiulina for reporting this issue. Be aware that only plain text can be used for draggables etc, however LayTex can be used in the body of the question text.
Version 1.978 of the Moodle Gapfill question type May 2020
Fixed issue with case sensitivity when using | operator and ignore duplicates
Thanks to Jason Rogers of the South Carolina Dept of Education and Dipak Kumar of Blackboard for reporting this and helping test the solution.
Fix for when force clean is on, which is planned to be a default, see
https://tracker.moodle.org/browse/MDL-62352
Thanks to Hubong Nguen for the UK OU who contributed a patch for wordselect without which I would not have known about this.
A fix for an error triggered in the question analysis in the quiz statistics report. Thanks to Chris Kenniburg of Dearborn schools for reporting this.
The editing form was ignoring the settings/default for fixedgapsize. It is now recognising this and
by default on installation the widths gaps will be set to that of the largest gap. See docs at
https://docs.moodle.org/en/Gapfill_question_type#Fixed_Gapsize. I noticed that myself.
Regular expressions are now disabled by default. Thanks to the suggestion from Howard Miller, legendry contributor at the Moodle.org forums.
https://github.com/marcusgreen/moodle-qtype_gapfill/issues/31
Version 1.977 of the Moodle Gapfill question type Oct 2019
Fixed an issue under Chrome for Windows where answer options (draggables) would not wrap as previously. Thanks to Joseph Rézeau for passing on the details as reported in the Moolde.org French forum by Jean-Gabriel DEPINOY.
The fixedgapsize setting is now set to on with fresh installs.
CSS fix for when the theme creates a paragraph for each gap. Thanks to feedback
from Daniel Garcia (https://top.totalenglish.net) that helped identify this.
Thanks to German Valero thanks for further Spanish translations of example questions.
Thanks to Dave Foord for help identifying a bug displaying wrong answers in dropdown mode
CSS was not being applied to correct/incorrect responses when in dropdown mode.
Switched to using amd modules in the javascript for question editing. No end user benefit
but will help in future development.
Version 1.976 of the Moodle Gapfill question type May 2019
Updated icon design to include a hint of color and in svg format.
More code compliance tweeks.
Increased number of english language sample questions to over 450
Version 1.975 of the Moodle Gapfill question type Jan 2019
Added a collection of sample english language questions in
examples\en\english_language.xml that can be imported.
Briefly tested with the Embed question filter
https://moodle.org/plugins/filter_embedquestion
When using Adaptive question behaviour the gapfeedback was always for a correct answer. Thanks to Joseph Rézeau for reporting that. Joseph also helped with improving the strings which will
help with translation.
The value for "show number of correct responses" checkbox on hints didn't do anything. That is now fixed. My thanks to Dr Anna Stefaidou for reporting this.
Changed fixedgapsize default to on for fresh installs (change in install.xml)
Fixed issue in mobile app where it gave the 'tap to select' prompt even when the question was in drop down mode.
Fixed an error message "Can not add jQuery plugins after starting page output!"
That showed when the question type was used in simple lesson
https://moodle.org/plugins/mod_simplelesson
and debug output was turned on. This would have shown in other modules that use the question engine.
Converted dragdrop.js to use amd modules, which is the standard
moodle way of handling javascript.
The utility
admin/cli/check_database_schema.php
threw errors after upgrade indicating incorrect data types and allow null settings. Fixed
the upgrade.php to use code generated by xmldb editor and also fixed
upgrade.php to use proper blocks of update code that checks version.
Restricted the scope of some css classes so they cannot interfere with other components/themes.
As reported here https://github.com/marcusgreen/moodle-qtype_gapfill/issues/39
Version 1.974 of the Moodle Gapfill question type Sep 2018
Spurious debugger statement found in mobile js code
Version 1.973 of the Moodle Gapfill question type Sep 2018
Support for the new Moodle 3.5 mobile app. Huge thanks to Dani Palou from Moodle HQ,
without his help I would not have been able to add this capability. Thanks to Elton LaClare
for help with testing.
Version 1.972 of the Moodle Gapfill question type May 2018
Fixed a bug where correct answers were shown even though it was turned off in the quiz settings checkbox.
My thanks to Matthias Giger and contributors to the Moodle German language for reporting this. Fixed
a bug introduced in the last release whereby the value of optionaftertext was not being saved. My thanks
to Elton LaClare for reporting that. Additional PHPDocs, code standards compliance and confirmation that
it works with Moodle 3.5.
Implemented privacy API for GDPR compliance, see discussion here
https://moodle.org/mod/forum/discuss.php?d=365857
Version 1.971 of the Moodle Gapfill question type Feb 2018
Bug fix for issue where dragdrop did not work on iOS. Improvements in code standards compliance.
Replaced various hard coded strings with get_string calls to allow for translation. Mythanks to Dinis Medeiros for reporting this.
The text in the letter hint prompt that appears in the Multiple tries section can be customised via the language pack. See instructions
https://docs.moodle.org/en/Language_customisation#Changing_words_or_phrases
Version 1.97 of the Moodle Gapfill question type Feb 2018
Letter hints, new feature which only works when Interactive with multiple tries behaviour is used. A new checkbox in the question
creation form toggles letterhints mode. This takes effect when an interactive question behaviour is selected. There is a global
checkbox setting for letterhints. If this is on, when a new question is created hints will be inserted into the first and second
boxes under multiple tries block. If it is toggled on with an existing question the hints will have to be added by hand in the
multiple tries section. Then when a student gives an incorrect response they will be given incrementing letters from the correct
answer when they press try again. Thanks to Elton LaClare for the idea for this and to his employer Sojo University Japan
http://www.sojo-u.ac.jp/en for funding.
Bug fix that broke the display of the quiz menu when optionsaftertext was selected but gapfill mode was selected. Thanks to
Lizardo Flores for reporting this.
Version 1.961 of the Moodle Gapfill question type Dec 2017
Mainly a bugfix where MS SQL server installations would not create the gapfill settings table.
My thanks to marisol castro for reporting this. Improvements to phpdoc comments
Version 1.96 of the Moodle Gapfill question type Oct 2017
Per gap feedback. This is a significant new feature and allows the creation of feedback that is
displayed dependent on if the student gave a correct or incorrect response on a per-gap basis The feedback is
entered by clicking a new button Gap settings which is shown under the question text field. This
toggles the screen to a grey colour and makes the text uneditable. Clicking a "gap" pops up a dialog
with fields for correct or incorrect response. Most HTML is stripped when the feedback is saved. Bold,
Italic, Underscore and hyperlinks are retained. The feedback area does not support images. It has been tested
with the contents of a 10K file (though that would not be a sensible use of the feature).
Substantial improvements to amount of phpdoc comments, which is only of benefit to developers
Version 1.95 of the Moodle Gapfill question type June 2017
New setting optionsaftertext can be to show the draggable options after the text. Thanks to Elton LaClare for the inspiration to do this.Fixed a bug where if there were multiple questions on a single page the draggables would become disabled after the first submit. Added behat featurefile add_quiz to test in
quiz rather than just in preview mode. Added dragging of selections (previously it was
only type in). Configured up .travis.yml so testing is run every time there is a
git commit. Made code tweaks to comply with results (e.g. csslint)
Version 1.94 of the Moodle Gapfill question type February 2017
This is a minor release with a css fix and improvements to the mobile app code.
Thanks to Chris Kenniburg for the CSS fix to remove the comma before focus. Added
fix to renderer.php so select element list shows down arrows on android mobile.
In the mobile app answer option selection is more obvious. For dragdrop
questions there is now a prompt that says "Tap to select then tap to drop" as with
the core question types. Thanks to Elton LaClare for the mobile app feedback.
Version 1.93 of the Moodle Gapfill question type February 2017
This release was made possible through the support of Sojo University Japan.
http://www.sojo-u.ac.jp/en/ . Many thanks to Elton LaClare and Rob Hirschel.
Added remote addon support for the Moodle mobile app. CSS to give indication of onfocus in text imput boxes, subtle change in
background color on hover over draggables. Other CSS tweaks to size of input and draggables. Fixed #25 on github
Version 1.92 of the Moodle Gapfill question type Nov 2016
CSS to improve dropdowns on chrome mobile, discard gaps in wrong answers which improves display in feedback for dropdowns.
Removed setting of height in em in styles.css which was breaking the display on iOS.
Version 1.91 of the Moodle Gapfill question type Oct 2016
[.+] will make any text a valid answer and if left empty will not show the .+ as aftergap feedbak
Version 1.9 of the Moodle Gapfill question type Oct 2016
In the admin interface there is now a link for import