Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I added fields to my quiz result at /admin/quiz/quiz-result-types/manage/quiz_result/form-display.
Now when I go to /quiz/1/take I see the fields instead of Question 1. This is great!
However, after filling out the fields and hitting the submit button, I'm redirected back to the form.
A new QuizResult entity was created with the form data saved, but no questions answered.
I'm thinking its the QuizController::take() function that is buggy.
if ($build_on_last || (is_a($field, FieldConfig::class) && $field->getThirdPartySetting('quiz', 'show_field'))) {
// We found a field to be filled out.
$redirect_url = Url::fromRoute('entity.quiz.take', ['quiz' => $quiz_result->getQuiz()->id()]);
$form = \Drupal::service('entity.form_builder')->getForm($quiz_result, 'default', ['redirect' => $redirect_url]);
return $form;
}
Comment | File | Size | Author |
---|---|---|---|
#4 | 3152601-4.patch | 1.04 KB | djdevin |
Comments
Comment #2
djdevinThis works if you check off "Allow resume" on the quiz.
The result isn't getting correctly put into the session after the fields are submitted.
Should probably wait until #3093971: Update session management to fix
Comment #3
sagesolutions CreditAttribution: sagesolutions commented@djdevin I checked the "Allow resume" box on the quiz, but that seemed to have no effect. I've added patch #18 from https://www.drupal.org/project/quiz/issues/3093971 successfully, but that still didn't continue with the questions after submitting the form.
Any other options need to be selected that I am missing?
Comment #4
djdevinThis should fix the issue against the latest dev.
Comment #5
sagesolutions CreditAttribution: sagesolutions commented@djdevin This patch now works in resuming the quiz.
Thanks for the patch!
Comment #7
djdevinFixed!