MDL-50484 lib_formslib: Persistant input should have different id

Persistant input is appended for frozen elements
and should have different id then the actual element
This commit is contained in:
Rajesh Taneja 2016-02-05 13:59:26 +08:00
parent 2aacd415e1
commit 1ebda3eb8c
7 changed files with 83 additions and 5 deletions

View file

@ -450,6 +450,8 @@ class gradingform_rubric_renderer extends plugin_renderer_base {
break;
default:
if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FROZEN && $value) {
// Id should be different then the actual input added later.
$attrs['id'] .= '_hidden';
$html .= html_writer::empty_tag('input', $attrs + array('type' => 'hidden', 'value' => $value));
}
// Display option as checkbox
@ -461,6 +463,8 @@ class gradingform_rubric_renderer extends plugin_renderer_base {
if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FROZEN || $mode == gradingform_rubric_controller::DISPLAY_PREVIEW) {
$attrs['disabled'] = 'disabled';
unset($attrs['name']);
// Id should be different then the actual input added later.
$attrs['id'] .= '_disabled';
}
$html .= html_writer::empty_tag('input', $attrs);
$html .= html_writer::tag('label', get_string($option, 'gradingform_rubric'), array('for' => $attrs['id']));