Is it possible to use DragMath when a student answers a Short Answer question?

Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
Number of replies: 24
Hello all,
Thank you very much to all developers of Moodle and DragMath!

I have installed Moodle and DragMath and I am able to use it as a teacher when creating questions.

Is it possible to use DragMath when a student answers a Short Answer question?

All I have is a plain text box for a student answer - I did not find a way to enable HTML editor that has DragMath toolbar button.

I know that there could be problems of matching students answers - but still.

Average of ratings: -
In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Mauno Korpelainen -
Well...yes and no.

Short answer question type is using plain input field - not textarea - and editor is used in moodle only for replacing textareas (with class form-textarea usually). Dragmath on the other hand is used as editor plugin although it would be possible to use it standalone (with a popup link to a page that has dragmath applet embedded or standalone tinymce with dragmath plugin in init code for example) and just copy the answer from popup etc.

But if you for example hack the core code and change short answer question type to use editor it means that editor is used always in short answer questions. Moodle has primarely essey question type for such cases...

Is there some special reason why you need dragmath in short answers?


In reply to Mauno Korpelainen

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
Mauno, Thank you very much for a quick reply!

1. The reason we would like to have DragMath in short answers is to use Moodle ability to check correctness of a student formula answer. I understand that some formulas could be written in different ways but still we would like to explorer this ability.

2. How do I hack the code and change short answer question type to always use editor?

3. I tried Essay question type and I only get plain text box as well. I did not find a way to turn HTML editor on. How do I turn it on? My Moodle version is 1.9.6.
In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Mauno Korpelainen -

Yegor,

1. I think this Dragmath response question type that Morten and Jean-Michel had used could be a nice way to add the mathematical notations. I could check the latest code of Dragmath and test how DRM questions work with moodle 1.9.6 or latest 1.9.7+...

2. Basicly you need to replace input field code with textarea code and correct class & tell moodle to render editor with a couple of functions (in moodle 1.9) but I can explain this later if 1 does not seem to work anymore. It's might be better to use different question type than to change actual short answer question type. It is also possible to change editor to tinymce and then a one line fix can be used to add editor to short answer questions but integration of tinymce (theme based or lib file based) is another and long story...

3. See http://moodle.org/mod/forum/discuss.php?d=90922&parent=608907#p608943 

In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Jean-Michel Védrine -
If I remember well from the 2007-2008 time, somebody has already done a "dragmath" questiontype.
It was imply a variation of the short answer question type but with a button to allow entering the equation with the dragmath editor.
It is in fact nearly the same code as the JME question type (same idea but to enter chemical molecules using the JME editor)
Unfortunately the code was never committed to Moodle CVS by the author
If you look at these forum messages you will find downloadable versions for Moodle 1.8 and 1.9
Of course I am not quite sure if this question type is still working with Moodle current version, but it would probably be less work to update it than to redo all the work.
In reply to Jean-Michel Védrine

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Mauno Korpelainen -

Thank you for the link, Jean-Michel!

I had never seen that post but if people need this "dragmath" question type it could be updated to use the latest version of Dragmath...

Moodleland is full of nice surprises big grin

In reply to Mauno Korpelainen

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Jean-Michel Védrine -
I have done a small test of the code with my current Moodle 1.9 version and it seems to work (Warning : I only did a small test)
As Mauno said, it would be best to update the code to use the latest version of DragMath and also to point to the Dragmath files already installed rather than to have another Dragmath version in the dmr folder. This would also avoid the trouble of having several places to setup Dragmath options.
In reply to Jean-Michel Védrine

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Jean-Michel Védrine -
I have done a modified version that use the DragMath version already installed on you Moodle (it must be in lib/DragMath/ folder wich I beleive to be the location of the latest DragMath version)
It will use whatever version installed there so if you have the latest version installed, it will use it.
It will also correctly switch to the right language.
Please note that it will NOT work if DragMath is not already installed on your Moodle server !!
If you have an older version of Dragmath response question type installed just replace the content of the question/type/dmr folder with the one from this zipfile.
Please test before using on a production site as this was a rapid fix so maybe I made some typos rouge testing was minimal.
If I succeed in retreiving my Moodle CVS login and password (not used for ages triste due to life constraints and health) I will commit this to contrib CVS and create a record in Modules and Plugins database.
In reply to Jean-Michel Védrine

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
Jean-Michel, Thank you very much!

I will try your version because http://www.jitt.dk/moodle/dmr19.zip version did not work - I get "Could not insert quiz dmr options!" error when I try to add a Quiz DMR question.
In reply to Jean-Michel Védrine

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
It does not work on my server sad I have Moode 1.9.6

Jean-Michel, I have installed your version and it looks like that I see a new version of DragMath equation editor. I able to write a formula in DragMath but when I add the new question I get the following error: "Error: Missing question options!" "Could not insert quiz dmr options!".
The question gets saved anyway but when I edit it I can see that the formula answer in "Answer 1" is not saved - probably there is some error in how the answer is saved. Question part of the question is getting saved.

I think that the problem is not in your changes - I was getting the same error in the original "DragMath Response" installation.
In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Itamar Tzadok -
A question type for DragMath may be an overkill. It can be easily implemented with the almighty CLOZE question type by anyone and the extra maintenance of core code or plugin can be spared. See image below. smile


Attachment dmr.png
In reply to Itamar Tzadok

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
Itamar, Thank you.

Could you point me to instructions on how to create this kind (DragMath) of CLOZE question?
In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Itamar Tzadok -
You need to disable editor (in the Moodle profile). Then go the question bank and create a CLOZE question and paste the following (remove X from Xonclick in the code):


<p>Write the equation for three carrots and two apples</p>
<div> <applet height="270" width="540" archive="Project.jar,AbsoluteLayout.jar,swing-layout-1.0.jar,jdom.jar,jep.jar" code="Display.MainApplet.class" codebase="http://moodle.yours.u/moodle/file.php/XXX/dmr/classes"> <param value="en" name="language" /> <param value="false" name="showOutputToolBar" /> <param value="Latex" name="outputFormat" /> To use this page you need a Java-enabled browser. Download the latest Java plug-in from <a href="http://www.java.com">Java.com</a></applet>
<div align="center"><input type="button" Xonclick='holder= this.parentNode.parentNode;txt=holder.getElementsByTagName("applet")[0].getMathExpression();holder.getElementsByTagName("div")[1].getElementsByTagName("input")[0].value=txt;' value="Insert from editor" /></div>
<br /><div align="center">{:SHORTANSWER:=3+2#~--------------------------------------------------------------------------------------#}</div> </div>

Replace codebase (red) with the correct path to the dmr classes. The files can be stored in the site Files or in a course Files (you can extract the classes from the zip of the dmr19 plugin you tried to install). Replace correct answer (blue) with the desired answer. Replace question description (green) with the desired one. Add question name, save, open and with some luck it will work.

Because of the javascript you cannot edit this question with the editor enabled. A simple interface for creating and editing such questions for import can be constructed in Excel or with Moodle database activity.

Hope this helps. smile
In reply to Itamar Tzadok

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Mauno Korpelainen -

Itamar,

this works too but I think Jean-Michel's/Morten's DragMath response question type as separate question type is simpler to use in quizzes.

In reply to Mauno Korpelainen

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Itamar Tzadok -
Maybe, but it comes with a price. With each question type added to the core Moodle becomes heavier and harder to maintain. Now, consider this question type. All it does is pasting a string from an applet to a short answer field. There are many more applets out there, so why this one and not others? And if others too, should we add a question type for each one? Perhaps we need a generic question type for applets. But we already have that - the Cloze question type. So perhaps we just need simple interfaces for creating such embedded questions. At any rate, judging by colleagues' reactions, the standard Moodle interface for adding questions only appears to make things simpler. The harsh reality hits the excited user when a few questions become a few dozens and then a few hundreds. smile
In reply to Itamar Tzadok

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Mauno Korpelainen -

Well...low price I would say... wink

I did not exactly say that this question type should be a core question type - I hoped that "It would be nice to get this question type also to moodle 2.0 that will have Dragmath as core plugin with tinymce."

DragMath will (most likely) have a permanent role in Wysiwyg equation editor plugin of TinyMCE (core moodle 2.0) so it will be easy to use also this DragMath Response question type - optional and separately installed or core (both are better than no option at all) - with the same core libraries and applets as editor plugin is using. The only difference is that moodle 2.0 is using folder lib/dragmath and moodle 1.9 is using folder lib/DragMath

http://tracker.moodle.org/browse/MDL-19521

There aren't yet even few dozens of different question types - 10 standard types and a handful of third-party question types

http://docs.moodle.org/en/Question_types

Still it does not prevent using any other question types like Cloze and embedding applets or using scripts. Once Petr has finished editor integration to moodle 2.0 we can start testing also additional (optional) editor configurations - for example Math editor configurations (with different open source or as well commercial plugins and applets) - because moodle 2.0 will allow several configurations or other pluggable editors with separate init code. In the long run moodle seems to be changing to a more and more flexible system that offers more choices but also more options to select which choices to enable by default and which to disable. wink

In reply to Mauno Korpelainen

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Itamar Tzadok -
Few/dozens/hundreds questions, not question types. Even those who use only MC questions are quickly discouraged by the tediousness of adding questions through the standard interface. But I still have to look into what Moodle 2 offers on this front. smile
In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Jean-Michel Védrine -
Hello Yegor,
Maybe you problem is simply that you have forgotten to visit Moodle Administration to create the tables for the new question type and this is why you get this error message ?
I see no reason why it should work on my Moodle install and not on yours.

In reply to Jean-Michel Védrine

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
Thank you, Jean-Michel!

I did not forget to visit Moodle Administration to create the tables - I did not know that I have to do it smile. Guys, I am totally new to Moodle - I have no idea. So detailed instruction are super helpful.

Where exactly do I have to go in Moodle Administration to create the tables and which tables I have to create? Thank you.
In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Mauno Korpelainen -

Yegor,

clicking Notifications (first link in Site Administration menu) has the same effect as going to http://yoursite/admin/index.php

README.txt file inside drm folder seems to have some more instructions.

In reply to Mauno Korpelainen

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
Clicking Notifications worked!!!
It works now! Wow! Great! Super! surprise
Thank you very much, guys! smile
I have to go now, I will write more tomorrow.
In reply to Jean-Michel Védrine

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Mauno Korpelainen -

Jean-Michel,

I tested your files and they worked really well with the latest DragMath - also with tinymce integration. And all output formats are supported, including asciimathml.

It would be nice to get this question type also to moodle 2.0 that will have Dragmath as core plugin with tinymce.

Thank You!

In reply to Jean-Michel Védrine

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
I just have to collect all installation instructions in one place.

To use DragMath when a student answers a Short Answer question (“Quiz” “Dragmath Response.” subtype of question):

1. Install DragMath for Moodle. Here is the link to instruction on how to do it:

http://docs.moodle.org/en/DragMath_equation_editor

2. For Moodle version 1.9.X unzip “dmr19.zip” file (creators Morten Brydensholt and Jean-Michel Vedrine):

http://moodle.org/file.php/5/moddata/forum/130/609001/dmr19.zip

in "<your moodle installation>/question/type" folder. It will create “dmr” folder in "<your moodle installation>/question/type" folder.

3. Copy content of "<your moodle installation>/question/type/dmr/lang" folder to "<your moodle installation>/lang” folder.

4. Click “Notifications” link on the Site Administration menu (first link in Site Administration menu). Or you can load “http:// <your moodle installation>/admin/index.php” link – it is equal to clicking “Notifications” link. You should see response that looks something like this - see the image below.

5. Now “Dragmath Response.” subtype of question should be available in “Quiz” type of question.
Attachment Moodle_DMR_inst2.png
In reply to Mauno Korpelainen

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Yegor Tarazevich -
Yes, people do need this "dragmath" question type. Our company is in a financial industry - we definitely would like to have this kind of capability.
MyMathLab/MathXL has this kind of capability - you can see it in this video presentation.

It would be great if this kind student formula answer is integrated in the next version of Moodle.
In reply to Yegor Tarazevich

Re: Is it possible to use DragMath when a student answers a Short Answer question?

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Dear all,

Sorry about joining this thread so late!

I think that DragMath is only half the story really.  Once you have your student give you a mathematical answer you will want to do things with it!  This is what I also designed STACK for.  Indeed, STACK came first, and then Alex and I worked on DragMath together to create a formula editor. 

http://www.stack.bham.ac.uk/wiki contains much more information.

Chris