$quiz->preventlate = 0;
}
- // Quiz name. (Make up a default if one was not given.)
- if (empty($quiz->name)) {
- if (empty($quiz->intro)) {
- $quiz->name = get_string('modulename', 'quiz');
- } else {
- $quiz->name = shorten_text(strip_tags($quiz->intro));
- }
- }
+ // Quiz name (now a required field).
$quiz->name = trim($quiz->name);
// Time limit. (Get rid of it if the checkbox was not ticked.)
$mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
$mform->setType('name', PARAM_TEXT);
+ $mform->addRule('name', null, 'required', null, 'client');
$mform->addElement('htmleditor', 'intro', get_string("introduction", "quiz"));
$mform->setType('intro', PARAM_RAW);