array('required' => true,␊ |
'label' => __('Shortname'),␊ |
'initial' => '',␊ |
'help_text' => __('It must be unique for each project and composed only of letters and digits.'),␊ |
'help_text' => __('It must be unique for each project and composed only of letters, digits and dash (-) like "my-project".'),␊ |
));␊ |
␊ |
$this->fields['scm'] = new Pluf_Form_Field_Varchar(␊ |
|
{␊ |
$shortname = $this->cleaned_data['shortname'];␊ |
if (preg_match('/[^\-A-Za-z0-9]/', $shortname)) {␊ |
throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters and digits.'));␊ |
throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters, digits and dash (-).'));␊ |
}␊ |
if (mb_substr($shortname, 0, 1) == '-') {␊ |
throw new Pluf_Form_Invalid(__('The shortname cannot start with the dash (-) character.'));␊ |