Skip to content

fix: autosaver #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025
Merged

fix: autosaver #193

merged 1 commit into from
Jul 22, 2025

Conversation

janbritz
Copy link
Contributor

@janbritz janbritz commented Jul 7, 2025

Closes #190

Unter mod/quiz/yui/src/autosave/js/autosave.js ist der Code zum Autosaver zu finden. Interessant ist hier Zeile 360 in welcher Y.io die äußere Form übergeben wird. In io-form.js kann man sehen wie die Formdaten serialisiert werden (_serialize): Es wird über über alle Elemente der Form (form.elements) iteriert und manuell ein Query-String gebaut, welcher die Key-Value-Paare beinhaltet. Damit wird also leider auch nicht das formdata-Event getriggert, weshalb unsere qpy_response-Daten nicht im Request zu finden sind.

Am einfachsten ist es also in der äußeren Form ein Element hinzuzufügen, welches dann die Formdaten der inneren Form "trägt". Dazu habe ich jetzt das autoSaveHintElement recycelt.

In autosave.js is folgender Kommentar aus 2019 zu finden

// (Yes, this is a nasty hack. One day this will be re-written as AMD, hopefully).

allerdings habe ich auf die schnelle dazu nichts im Moodle Tracker finden können.

@janbritz janbritz requested review from MartinGauk and MHajoha July 7, 2025 11:39
Copy link
Member

@MHajoha MHajoha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gute Lösung 👍

Moodle ist eine Handvoll Hacks und Zwischenlösungen in einem Trenchcoat

@janbritz janbritz merged commit eb15d2c into dev Jul 22, 2025
0 of 6 checks passed
@janbritz janbritz deleted the fix/autosaver branch July 22, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autosave funktioniert nicht
2 participants