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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user