Moodle
  1. Moodle
  2. MDL-5309

Use HTML editor to edit answers of multiple-choice questions

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.8.4
    • Fix Version/s: None
    • Component/s: Questions
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_18_STABLE
    • Rank:
      3201

      Description

      When creating a multiple answer question then at the question text a html editor can be used. It would be necessary at the answers also. Now I had to write html tag to a single row.

        Issue Links

          Activity

          Hide
          Martin Dougiamas added a comment -

          From Gustav Delius (gwd2 at york.ac.uk) Monday, 24 April 2006, 04:08 PM:

          Th html editor is not used all over simply to make pages render more quickly and to save space on the screen. I think this problem should be solved Moodle-wide by giving the user the ability to switch any textarea between ordinary text area and html editor. Such a feature request for a Moodle-wide change already exists.

          Show
          Martin Dougiamas added a comment - From Gustav Delius (gwd2 at york.ac.uk) Monday, 24 April 2006, 04:08 PM: Th html editor is not used all over simply to make pages render more quickly and to save space on the screen. I think this problem should be solved Moodle-wide by giving the user the ability to switch any textarea between ordinary text area and html editor. Such a feature request for a Moodle-wide change already exists.
          Hide
          Steve Bond added a comment -

          If anyone wants to achieve this quickly, just edit:

          /question/type/multichoice/edit_multichoice_form.php

          line 47 (in Moodle 1.9)

          Change the argument 'text' to 'htmleditor'.

          Show
          Steve Bond added a comment - If anyone wants to achieve this quickly, just edit: /question/type/multichoice/edit_multichoice_form.php line 47 (in Moodle 1.9) Change the argument 'text' to 'htmleditor'.
          Hide
          mirek added a comment -

          if you want to change this in version 1.9.7, there is different way to provide this functionality. you have to make change in the file edit_question_form.php in the directory question/type, which contains class question_edit_form, which is the base class of question_edit_multichoice_form. here you have to make changes on lines two lines:

          • line 105, which is responsible for the input of question, from

          $mform->addElement('text', 'name', get_string('questionname', 'quiz'), array('size' => 50));

          to

          $mform->addElement('htmleditor', 'name', get_string('questionname', 'quiz'), array('size' => 50));

          • and line 255, which is responsible for the input of answer, from

          $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 50));

          to

          $repeated[] =& $mform->createElement('htmleditor', 'answer', get_string('answer', 'quiz'), array('size' => 50));

          and thats it. i found this change while upgrading from 1.9.2 to 1.9.7. so thats pity, nothing change here for over than 3 years...

          Show
          mirek added a comment - if you want to change this in version 1.9.7, there is different way to provide this functionality. you have to make change in the file edit_question_form.php in the directory question/type, which contains class question_edit_form, which is the base class of question_edit_multichoice_form. here you have to make changes on lines two lines: line 105, which is responsible for the input of question, from $mform->addElement('text', 'name', get_string('questionname', 'quiz'), array('size' => 50)); to $mform->addElement('htmleditor', 'name', get_string('questionname', 'quiz'), array('size' => 50)); and line 255, which is responsible for the input of answer, from $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 50)); to $repeated[] =& $mform->createElement('htmleditor', 'answer', get_string('answer', 'quiz'), array('size' => 50)); and thats it. i found this change while upgrading from 1.9.2 to 1.9.7. so thats pity, nothing change here for over than 3 years...
          Hide
          Dmitry Pupinin added a comment -

          No need to change line 105. Title of question should be simple text field.
          This patch add html editor to answers of all question types and additional to left side of matches in match type.

          Show
          Dmitry Pupinin added a comment - No need to change line 105. Title of question should be simple text field. This patch add html editor to answers of all question types and additional to left side of matches in match type.
          Hide
          mirek added a comment -

          yes - there is big need to change it. simple reason is - i teach computer studies. if i want to show part of the code, it's really hard to write it to single text box. you can try and then try to go to the beginning of the question. you'll see

          Show
          mirek added a comment - yes - there is big need to change it. simple reason is - i teach computer studies. if i want to show part of the code, it's really hard to write it to single text box. you can try and then try to go to the beginning of the question. you'll see
          Hide
          Steve Bond added a comment -

          This patch now causes a problem as a result of changes introduced elsewhere by http://tracker.moodle.org/browse/MDL-18035

          When creating a numerical question type, there is a fatal error at line 23 of /question/type/numerical/edit_numerical_form.php:

          $repeated[1]->setSize(10);

          This is trying to set the size of the answer field, but because that answer field is now an HTML editor, the setSize() method does not exist.

          I have fixed this locally by commenting out the above line.

          However, it is doubtful that an HTML editor is really required for the answer fields of a numerical question type, since they are not displayed to the student (the same argument applies to the short-answer question type, I think). So really what is needed is a way to specify the answer field types on a question-type by question-type basis.

          Show
          Steve Bond added a comment - This patch now causes a problem as a result of changes introduced elsewhere by http://tracker.moodle.org/browse/MDL-18035 When creating a numerical question type, there is a fatal error at line 23 of /question/type/numerical/edit_numerical_form.php: $repeated [1] ->setSize(10); This is trying to set the size of the answer field, but because that answer field is now an HTML editor, the setSize() method does not exist. I have fixed this locally by commenting out the above line. However, it is doubtful that an HTML editor is really required for the answer fields of a numerical question type, since they are not displayed to the student (the same argument applies to the short-answer question type, I think). So really what is needed is a way to specify the answer field types on a question-type by question-type basis.
          Hide
          Tim Hunt added a comment -

          This was fixed in Moodle 2.1

          Show
          Tim Hunt added a comment - This was fixed in Moodle 2.1

            People

            • Votes:
              6 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: