Bug with response template - answers lost

Bug with response template - answers lost

by François Lizotte -
Number of replies: 7
Picture of Particularly helpful Moodlers

Hello,

I ran into this today on Moodle 3.8 and I just reproduced it on qa.moodledemo.org (3.10 dev).

In an essay question with a response template containing a table, the answers were swept and cannot be found in the database.

Looking at HTML source, I got this:

<table style="width: 90%;">
    <caption>Réponse:</caption>
    <thead>
        <tr>
            <th scope="col">Justification:<br><br><br></th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

I know that the caption tag is somehow unusual, but it probably comes from a copy/paste and causes a very frustrating situation: the table disappears but only after the quiz is submitted and nothing shows up in the database.

Should I open de new issue? I assume there is some cleaning routine that toom away the table.

François

EDIT: It works if I remove the <thead> tags.

EDIT 2: It also works if we add something in the body.



Average of ratings: -
In reply to François Lizotte

Re: Bug with response template - answers lost

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Bonsoir François,

If you don't have anything in the body of the table, Moodle probably notices that the table is empty and it's not too surprising that it removes it.

You can fix your template by simply changing thead to tbody:

<table style="width: 90%;">
    <caption>Réponse:</caption>
    <tbody>
        <tr>
            <th scope="col">Justification:<br><br><br></th>
        </tr>
    </tbody>
</table>
In reply to Dominique Bauer

Re: Bug with response template - answers lost

by François Lizotte -
Picture of Particularly helpful Moodlers
Merci Dominique.

It makes sense, but it's really annoying for a teacher who probably just copied the table from an external source and thought everything was fine. I wish the table would disappear when the response template is save, not when the attempt is sent to the server.

François
In reply to François Lizotte

Re: Bug with response template - answers lost

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Moodle is clever enought to notice if the student has not modified the template. If the student has not done anything, we don't save it.

Do you have a sitation where the student actually wrote an answer, and it was not saved?
In reply to Tim Hunt

Re: Bug with response template - answers lost

by François Lizotte -
Picture of Particularly helpful Moodlers
Hi Tim,

Yes, it was reported to me yesterday that some answers were lost. I tested the question in preview mode and I can confirm that everything is fine until submission. I entered text above and below the table and it remained there, but everything in the table is lost.

All we had in the database was a NULL entry for these attempts.

François
In reply to François Lizotte

Re: Bug with response template - answers lost

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
François,

In the response with a table as in the original post, students can only write an answer in the caption or in the head of the table, but not in the body since it has not been created and therefore does not exist. Hence, upon submission, Moodle detects an empty table, that is, a table without a body, and deletes it.

You can create a table without a body and it will be displayed as is, in a question text, a description question or any other activity. But if it is part of the student's response to an essay question, Moodle will delete it.

Don't expect the Atto editor in the question settings to run the same cheks as a question module when the student's answer is interpreted.

...it's really annoying for a teacher who [...] thought everything was fine.
I would suggest that you recommend to your teachers to just preview their quizzes and test them before putting them online.
Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Bug with response template - answers lost

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

Dominique "I would suggest that you recommend to your teachers to just preview their quizzes and test them before putting them online."

Wise advice.Yes

In reply to Joseph Rézeau

Re: Bug with response template - answers lost

by François Lizotte -
Picture of Particularly helpful Moodlers
Gentlemen, thank you for your wisdom.

I understand that it's not really a bug, but let's call it an accident.

Merci encore.