Browse Source

Fix textarea id BT#16144

Julio Montoya 5 years ago
parent
commit
baa827304d
1 changed files with 7 additions and 5 deletions
  1. 7 5
      main/exercise/exercise_show.php

+ 7 - 5
main/exercise/exercise_show.php

@@ -620,22 +620,24 @@ foreach ($questionList as $questionId) {
             $renderer->setFormTemplate('<form{attributes}><div>{content}</div></form>');
             $renderer->setCustomElementTemplate('<div>{element}</div>');
             $comnt = Event::get_comments($id, $questionId);
-            $default = ['comments_'.$questionId => $comnt];
+
+            $textareaId = 'comments_'.$questionId;
+            $default = [$textareaId => $comnt];
 
             if ($useAdvancedEditor) {
                 $feedback_form->addElement(
                     'html_editor',
-                    'comments_'.$questionId,
-                    null,
+                    $textareaId,
                     null,
+                    ['id' => $textareaId],
                     [
                         'ToolbarSet' => 'TestAnswerFeedback',
                         'Width' => '100%',
-                        'Height' => '120',
+                        'Height' => '120'
                     ]
                 );
             } else {
-                $feedback_form->addElement('textarea', 'comments_'.$questionId);
+                $feedback_form->addElement('textarea', $textareaId, ['id' => $textareaId]);
             }
             $feedback_form->setDefaults($default);
             $feedback_form->display();