Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

MDL-35726: Use a different form identifier for each form when using "…

…Save and next"

This prevents a bug where the next student feedback will default to the values that
were on the last submitted form. This is a similar case to having multiple instances
of the same form on the same page - each one needs a unique identifier to distinguish
between them. In this case I include the $rownum which changes as you go to each student
in the list.
  • Loading branch information...
commit 0e8aa5027eb7cb2bfa66e55f164c2d3409a8e02b 1 parent f2c33d0
Damyon Wiese authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 mod/assign/gradeform.php
11 mod/assign/gradeform.php
@@ -60,6 +60,17 @@ function definition() {
+ * This is required so when using "Save and next", each form is not defaulted to the previous form.
+ * Giving each form a unique identitifer is enough to prevent this (include the rownum in the form name).
+ *
+ * @return string - The unique identifier for this form.
+ */
+ protected function get_form_identifier() {
+ $params = $this->_customdata[2];
+ return get_class($this) . '_' . $params['rownum'];
+ }
+ /**
* Perform minimal validation on the grade form
* @param array $data
* @param array $files
Please sign in to comment.
Something went wrong with that request. Please try again.