Select Moodle version:

## Question types: Drag-and-Drop Matching

qtype_ddmatch
Question type similar to the matching question type but with a drag and drop interface for the students during attempt.
Maintained by: Jean-Michel Védrine

Created by Adriane Boyd during 2007 Google Summer Of Code, the drag and drop matching question type is quite similar to the matching question type found in standard Moodle, differences are:

• during question creation/edition of drag and drop matching questions, an editor is available for each answer (in standard matching question this is not possible because these elements are displayed inside a select menu during question attempts)
• during question attempts a drag and drop interface is displayed and the student must drag each right element on the correct spot on the left.

### Contributors

Andrew Nicols: Javascript upgrade to YUI3

• Tue, Jun 25, 2013, 5:21 PM
Hi,
we are having a problem restoring courses: When restoring a course with ddmatch questions from a backup file, it fails with the following error:

the table "question_match" doesn't exist
Debug info:
Error code: ddltablenotexist
Stack trace:
line 554 of /lib/dml/moodle_database.php: dml_exception thrown
line 1579 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
line 197 of /question/type/ddmatch/backup/moodle2/restore_qtype_ddmatch_plugin.class.php: call to moodle_database->set_field()
line 84 of /backup/moodle2/restore_plugin.class.php: call to restore_qtype_ddmatch_plugin->after_execute_question()
line 362 of /backup/util/plan/restore_structure_step.class.php: call to restore_plugin->launch_after_execute_methods()
line 108 of /backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->launch_after_execute_methods()
line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
line 163 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
line 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
line 46 of /backup/restore.php: call to restore_ui->execute()

we recently upgraded from 2.3 to 2.5 (it was OK in 2.3) Apparently the restore script calls to the old mdl_question_match table, instead of mdl_qtype_match_options

I filed a bug report: CONTRIB-4437 (if my solution is correct, please close the bug report)

However, after reviewing the script "restore_qtype_ddmatch_plugin.php" (in ddmatch/backup/moodle2/), the only reference to "question_match I found was in line 202:

$DB->set_field('question_match', 'subquestions',$subquestions,

So, I replaced "question_match" by "question_ddmatch" as below:

$DB->set_field('question_ddmatch', 'subquestions',$subquestions,

After that, in a test moodle site I created a new course with one ddmatch question and performed the backup / restore without errors.

Since I'm not an sql expert I'd like you to confirm this before I make the change in my production site.

• Thu, Jun 27, 2013, 3:09 AM
Thanks a lot to Rui ruas,
The problem in restore of backups should be fixed now, and I have released separated versions for Moodle 2.4 and 2.5 for better adaptation to the changes in the question edit page in Moodle 2.5. Report any problem.
• Thu, Jul 18, 2013, 9:16 AM
Hi,
I just added a Moodle Docs page at http://docs.moodle.org/25/en/Drag_and_drop_matching_question_type

and listed this question type in http://docs.moodle.org/25/en/Question_types#Third-party_question_types

I hope you don't mind
• Thu, Aug 1, 2013, 8:00 PM
I am afraid the bug mentioned in CONTRIB-4437 still persists. At least I have been unable to restore the ddmatch question on an up to date Moodle 2.5.1+ site. Please see comment on tracker.
• Thu, Aug 1, 2013, 10:31 PM
Hello Martin,
Thanks for reporting this problem. Unfortunately this is not the same problem I have made a typo when changing all tables names for the version for moodle 2.5 and it is unfortunate because I made this typo in the backup code (I wrote qtype_match_subquestions and it should have been qtype_ddmatch_subquestions) so what is unfortunate is that backups made with this version don't contain ddmatch subquestions and subanswers so they are broken and it will no be possible to repair them.
I apologize for any inconveniences his may have cused to ddmach users.
I will release a corrected version ASAP but I want to test it before release.
Until this new version is released, don't make any backup of course containing ddmatch questions.
• Thu, Aug 1, 2013, 10:46 PM
Dear Jean-Michel,
Thank you so much for your quick response. No worries, I spotted the problem before any of the old courses were removed.
I am looking forward to downloading the updated version! Once again, thanks a million for all the work you put into the ddmatch question type. It's appreciated!
• Thu, Aug 1, 2013, 11:18 PM
I just installed the github version and it's working like a charm! Kudos!!!
• Thu, Sep 19, 2013, 5:54 AM
Our Moodle server is 2.4, and obviously the question type doesn't work since it's not 2.4.1. What are the main things absent from 2.4 that allow this question type to work in 2.4.1, though?
• Thu, Sep 19, 2013, 10:29 PM
Hello Justin, sorry but i don't remember what the problem was, but there was a reason for sure because i remember modifying version.php just so that it require 2.4.1.
I should have written something about the problem in the readme, but unfortunately I didn't
• Thu, Feb 13, 2014, 10:38 PM
I have a problem with this question in 2.6
• Thu, Feb 13, 2014, 11:13 PM
Hello, I use this question and I don't see any problem in Moodle 2.6 . You are the first one to report a problem. Please use the tracker (https://tracker.moodle.org/browse/CONTRIB) or the Quiz forum (https://moodle.org/mod/forum/view.php?id=737) to describe your problems.
• Tue, Feb 18, 2014, 2:22 PM
ok. I try to explain here (never use traker, and sorry for my english)

1) We use "Drag-and-Drop Matching" questions with Tex. in 2.6 no one Tex formulae not displaed.

2) "Drag-and-Drop Matching" - several box which student can move with mouse, but in 2.6 this question looks like usual match question - just dropdown list.
• Tue, Feb 18, 2014, 3:23 PM
Hello,
As I said I am totally unable to reproduce your problems: my drag and drop question are working in Moodle 2.6 with no problem and my TeX formulas are displayed both in the subquestions and in the answers. Sorry it must be something with your system, your theme or your version of the ddmatch plugin.
• Tue, Feb 18, 2014, 3:28 PM
I forgot to say that I use MathJax to display TeX formulas.
• Tue, Feb 18, 2014, 3:38 PM
I made another test to display TeX formulas inside ddmatch questions using the "TeX notation" filter of Moodle and it works too. No problem here.