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.
This commit is contained in:
Damyon Wiese
2012-10-12 12:07:19 +08:00
parent f2c33d0b69
commit 0e8aa5027e
+11
View File
@@ -59,6 +59,17 @@ class mod_assign_grade_form extends moodleform {
}
}
/**
* 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