diff --git a/course/yui/toolboxes/toolboxes.js b/course/yui/toolboxes/toolboxes.js index d3a98116a55..09550956f09 100644 --- a/course/yui/toolboxes/toolboxes.js +++ b/course/yui/toolboxes/toolboxes.js @@ -517,7 +517,8 @@ YUI.add('moodle-course-toolboxes', function(Y) { 'name' : 'title', 'value' : titletext, 'autocomplete' : 'off', - 'aria-describedby' : 'id_editinstructions' + 'aria-describedby' : 'id_editinstructions', + 'maxLength' : '255' }) .addClass('titleeditor'); var editform = Y.Node.create('
') diff --git a/mod/assign/mod_form.php b/mod/assign/mod_form.php index 7e781c2f51f..4101ab11283 100644 --- a/mod/assign/mod_form.php +++ b/mod/assign/mod_form.php @@ -54,6 +54,7 @@ class mod_assign_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor(true, get_string('description', 'assign')); diff --git a/mod/assignment/mod_form.php b/mod/assignment/mod_form.php index 56b407d6ea6..bc0818fea2e 100644 --- a/mod/assignment/mod_form.php +++ b/mod/assignment/mod_form.php @@ -45,6 +45,7 @@ class mod_assignment_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor(true, get_string('description', 'assignment')); diff --git a/mod/book/mod_form.php b/mod/book/mod_form.php index 85b96911af8..40d9f72d3d4 100644 --- a/mod/book/mod_form.php +++ b/mod/book/mod_form.php @@ -45,6 +45,7 @@ class mod_book_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor($config->requiremodintro, get_string('moduleintro')); // Appearance. diff --git a/mod/chat/mod_form.php b/mod/chat/mod_form.php index 31a5d6243a4..7d5b999ff20 100644 --- a/mod/chat/mod_form.php +++ b/mod/chat/mod_form.php @@ -22,6 +22,7 @@ class mod_chat_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor(true, get_string('chatintro', 'chat')); diff --git a/mod/choice/mod_form.php b/mod/choice/mod_form.php index 8cca80fd67d..59fce157bdc 100644 --- a/mod/choice/mod_form.php +++ b/mod/choice/mod_form.php @@ -22,6 +22,7 @@ class mod_choice_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor(true, get_string('chatintro', 'chat')); diff --git a/mod/data/mod_form.php b/mod/data/mod_form.php index 76a72dbfa97..ff56b7a537a 100644 --- a/mod/data/mod_form.php +++ b/mod/data/mod_form.php @@ -22,6 +22,7 @@ class mod_data_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor(true, get_string('intro', 'data')); diff --git a/mod/feedback/mod_form.php b/mod/feedback/mod_form.php index b49ea51253a..3712367f262 100644 --- a/mod/feedback/mod_form.php +++ b/mod/feedback/mod_form.php @@ -44,6 +44,7 @@ class mod_feedback_mod_form extends moodleform_mod { $mform->addElement('text', 'name', get_string('name', 'feedback'), array('size'=>'64')); $mform->setType('name', PARAM_TEXT); $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor(true, get_string('description', 'feedback')); diff --git a/mod/folder/mod_form.php b/mod/folder/mod_form.php index 1dc61b7363e..02ab56ac590 100644 --- a/mod/folder/mod_form.php +++ b/mod/folder/mod_form.php @@ -44,6 +44,7 @@ class mod_folder_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- diff --git a/mod/glossary/mod_form.php b/mod/glossary/mod_form.php index 0362aed1d61..50163f6e619 100644 --- a/mod/glossary/mod_form.php +++ b/mod/glossary/mod_form.php @@ -22,6 +22,7 @@ class mod_glossary_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor(true); diff --git a/mod/imscp/mod_form.php b/mod/imscp/mod_form.php index cd3c2efbe9f..06eeccc7792 100644 --- a/mod/imscp/mod_form.php +++ b/mod/imscp/mod_form.php @@ -45,6 +45,7 @@ class mod_imscp_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- diff --git a/mod/lesson/mod_form.php b/mod/lesson/mod_form.php index 6575ce2a978..27c8a4b51a3 100644 --- a/mod/lesson/mod_form.php +++ b/mod/lesson/mod_form.php @@ -89,6 +89,7 @@ class mod_lesson_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); // Appearance. $mform->addElement('header', 'appearancehdr', get_string('appearance')); diff --git a/mod/lti/mod_form.php b/mod/lti/mod_form.php index 377c07da100..6e75dce2d19 100644 --- a/mod/lti/mod_form.php +++ b/mod/lti/mod_form.php @@ -67,6 +67,7 @@ class mod_lti_mod_form extends moodleform_mod { $mform->addElement('text', 'name', get_string('basicltiname', 'lti'), array('size'=>'64')); $mform->setType('name', PARAM_TEXT); $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); // Adding the optional "intro" and "introformat" pair of fields $this->add_intro_editor(false, get_string('basicltiintro', 'lti')); $mform->setAdvanced('introeditor'); diff --git a/mod/page/mod_form.php b/mod/page/mod_form.php index ebb9154c8db..6d576f42e26 100644 --- a/mod/page/mod_form.php +++ b/mod/page/mod_form.php @@ -47,6 +47,7 @@ class mod_page_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index a7b98a1fd3c..297baa08b6b 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -69,6 +69,7 @@ class mod_quiz_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); // Introduction. $this->add_intro_editor(false, get_string('introduction', 'quiz')); diff --git a/mod/resource/mod_form.php b/mod/resource/mod_form.php index 66b5ce8e248..9d4482a1d8e 100644 --- a/mod/resource/mod_form.php +++ b/mod/resource/mod_form.php @@ -55,6 +55,7 @@ class mod_resource_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index c6588229cc7..be0636472c2 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -43,6 +43,7 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); // Summary $this->add_intro_editor(true); diff --git a/mod/url/mod_form.php b/mod/url/mod_form.php index ae5ef47759c..9fde60aa7a8 100644 --- a/mod/url/mod_form.php +++ b/mod/url/mod_form.php @@ -45,6 +45,7 @@ class mod_url_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- diff --git a/mod/wiki/mod_form.php b/mod/wiki/mod_form.php index 942ece0513c..774527f48c9 100644 --- a/mod/wiki/mod_form.php +++ b/mod/wiki/mod_form.php @@ -53,7 +53,8 @@ class mod_wiki_mod_form extends moodleform_mod { $mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64')); $mform->setType('name', PARAM_TEXT); $mform->addRule('name', $required, 'required', null, 'client'); - // Adding the optional "intro" and "introformat" pair of fields. + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); + // Adding the optional "intro" and "introformat" pair of fields $this->add_intro_editor(true, get_string('wikiintro', 'wiki')); $wikimodeoptions = array ('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki'));