Drag and drop onto image: could not drop image after saving

Drag and drop onto image: could not drop image after saving

by Anton Tremetzberger -
Number of replies: 11
Picture of Particularly helpful Moodlers

Dear community,

we have some strange issue with question type "Drag and Drop onto Image": we have a few draggable items in a question. Some of them are set to "unlimited", some of them are set to "limited".

In a preview mode I can drag these items to the correct fields. If I press "Save" it is not possible to drag items which are set to "unlimited". It is only possible to drag images which are set to "limited".
The same issue is also during quizzes: if a student answers this drag and drop-question, switch to an other question and go back to the drag and drop-question, the student is not allowed to drag images which are set to "unlimited".

Attached you can find a screenshot. Another strange thing is, that the error does not always occur. We are using Moodle 3.9.9.


Maybe it is related to some bug fixes (Drag and drop questions with 'unlimited' options fail in Moodle 3.9: https://tracker.moodle.org/browse/MDL-69266), but this bug fix is closed.

Does anyhone have the same problem?

best regards, Anton

Average of ratings: -
In reply to Anton Tremetzberger

Re: Drag and drop onto image: could not drop image after saving

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
@Anton,
Please export your question and attach it to your reply so we can experiment with it.
In reply to Joseph Rézeau

Re: Drag and drop onto image: could not drop image after saving

by Anton Tremetzberger -
Picture of Particularly helpful Moodlers
Joseph, attached you can find the drag and drop-question in moodle XLM format.
br, Anton
In reply to Anton Tremetzberger

Re: Drag and drop onto image: could not drop image after saving

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
There are no questions in that xml file. How did you do your export?
In reply to Joseph Rézeau

Re: Drag and drop onto image: could not drop image after saving

by Anton Tremetzberger -
Picture of Particularly helpful Moodlers
Joseph,
I have exported only the question, maybe the file is corrupted. Attached you can find the file again as rar-file, hope it will work now.

@Tim: thank you for the link to the tracker - exactly, this should be the same problem.

br, Anton
In reply to Anton Tremetzberger

Re: Drag and drop onto image: could not drop image after saving

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Anton,

Thanks for the new export file, which I have been able to import into my Moodle test site to examine.

Here are my findings, using Moodle 3.11.4 (Build: 20211108) and debug mode set to DEVELOPER: extra Moodle debug messages for developers

1.- When I Preview your question I get these errors:

Too much data passed as arguments to js_call_amd("qtype_ddimageortext/question", "init"). Generally there are better ways to pass lots of data from PHP to JavaScript, for example via Ajax, data attributes, ... . This warning is triggered if the argument string becomes longer than 1024 characters.

    line 1057 of \lib\outputrequirementslib.php: call to debugging()
    line 117 of \question\type\ddimageortext\rendererbase.php: call to page_requirements_manager->js_call_amd()
    line 388 of \question\engine\renderer.php: call to qtype_ddtoimage_renderer_base->formulation_and_controls()
    line 109 of \question\engine\renderer.php: call to core_question_renderer->formulation()
    line 113 of \question\behaviour\behaviourbase.php: call to core_question_renderer->question()
    line 907 of \question\engine\questionattempt.php: call to question_behaviour->render()
    line 461 of \question\engine\questionusage.php: call to question_attempt->render()
    line 253 of \question\preview.php: call to question_usage_by_activity->render_question()

I expect this will mean something to Tim.

2.- You write "In a preview mode I can drag these items to the correct fields. If I press "Save" it is not possible to drag items which are set to "unlimited". It is only possible to drag images which are set to "limited"."

I don't see this problem. After clicking Save I can drag any element...

3.- You write "The same issue is also during quizzes: if a student answers this drag and drop-question, switch to an other question and go back to the drag and drop-question, the student is not allowed to drag images which are set to "unlimited"."

I don't see this problem. After clicking switching to another question/page and coming  back to your drag and drop quetion I can drag any element...

In reply to Joseph Rézeau

Re: Drag and drop onto image: could not drop image after saving

by Anton Tremetzberger -
Picture of Particularly helpful Moodlers

Dear Joseph,

thank you for testing. We are using Moodle 3.9.9+ (Build: 20210812). Maybe the problem only occurs with older Moodle versions? I'm aware that our version is not the latest version (actually we are preparing some new moodle test environments, but we are not finished yet).

Attached you can find two videos: 1. question preview and 2. quiz attempt. In the quiz attempt video you can see that sometimes it will work and sometimes not.

I can't set debug mode at the moment, but if it is necessary I can record some debug messages in the next days.

br, Anton

In reply to Joseph Rézeau

Re: Drag and drop onto image: could not drop image after saving

by Ava Taylor -

we have moodle 3.9.6+ and are also getting the "Too much data passed as arguments to js_call_amd..." error message in a few of our "drag and drop onto image" type questions when "Debug messages" is set to "DEVELOPER: extra Moodle debug messages for developers" and "Display debug messages" is set to "Yes"

is there a solution for this? is this really an error? it is a user misuse of some feature?

In reply to Ava Taylor

Re: Drag and drop onto image: could not drop image after saving

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Upgrade to the latest release. The 3.9 branch is up to 3.9.17. https://moodledev.io/general/releases#moodle-39-lts
In reply to Tim Hunt

Re: Drag and drop onto image: could not drop image after saving

by Ava Taylor -

as much as want to - I'm afraid currently cannot upgrade our moodle. is there a certain patch or other piece of code I can use to fix this issue in our 3.9.6+ one? I'm referring to the "Too much data passed as arguments to js_call_amd..." error message in a few of the "drag and drop onto image" type questions.

In reply to Ava Taylor

Re: Drag and drop onto image: could not drop image after saving

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well the code is all there in git version control (e.g. https://github.com/moodle/moodle/commits/MOODLE_39_STABLE/question/type/ddimageortext - and the corresponding bug reports can be found at https://tracker.moodle.org/).

It might be possible to extract the relevant changes, and apply them to your system. But, doing things like that just makes it even harder to upgrade in future, so proceed with caution.
In reply to Anton Tremetzberger

Re: Drag and drop onto image: could not drop image after saving

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think this is MDL-72915.

That was nearly fixed, but an issue was found, and now work on it stalled. Hopefully we can get the fix over the line soon.