diff --git a/enrol/self/edit_form.php b/enrol/self/edit_form.php index a1e3a8069b3..b035bd31252 100644 --- a/enrol/self/edit_form.php +++ b/enrol/self/edit_form.php @@ -39,8 +39,10 @@ class enrol_self_edit_form extends moodleform { $mform->addElement('header', 'header', get_string('pluginname', 'enrol_self')); - $mform->addElement('text', 'name', get_string('custominstancename', 'enrol')); + $nameattribs = array('size' => '20', 'maxlength' => '255'); + $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'), $nameattribs); $mform->setType('name', PARAM_TEXT); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'server'); $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no')); @@ -52,11 +54,13 @@ class enrol_self_edit_form extends moodleform { $mform->addHelpButton('customint6', 'newenrols', 'enrol_self'); $mform->disabledIf('customint6', 'status', 'eq', ENROL_INSTANCE_DISABLED); - $mform->addElement('passwordunmask', 'password', get_string('password', 'enrol_self')); + $passattribs = array('size' => '20', 'maxlength' => '50'); + $mform->addElement('passwordunmask', 'password', get_string('password', 'enrol_self'), $passattribs); $mform->addHelpButton('password', 'password', 'enrol_self'); if (empty($instance->id) and $plugin->get_config('requirepassword')) { $mform->addRule('password', get_string('required'), 'required', null, 'client'); } + $mform->addRule('password', get_string('maximumchars', '', 50), 'maxlength', 50, 'server'); $options = array(1 => get_string('yes'), 0 => get_string('no'));