function admin_add_degree_form_validate
Search API
7.x admin.degrees.inc | admin_add_degree_form_validate($form, $form_submit) |
6.x admin.degrees.inc | admin_add_degree_form_validate($form, $form_submit) |
5.x admin.degrees.inc | admin_add_degree_form_validate($form, $form_submit) |
Validate handler for add_degree_form
File
- modules/
admin/ admin.degrees.inc, line 530
Code
function admin_add_degree_form_validate($form, $form_submit) {
$values = $form_submit ["values"];
// Make sure neither major code nor track code contains any spaces.
$major_code = trim(strtoupper($values ["major_code"]));
$track_code = trim(strtoupper($values ["track_code"]));
if (strstr($major_code, " ")) {
form_error("major_code", t("The major code may not contain spaces. Please enter a new one containing only letters and numbers."));
return;
}
if (strstr($track_code, " ")) {
form_error("track_code", t("The track code may not contain spaces. Please enter a new one containing only letters and numbers."));
return;
}
// Make sure the major + |_ + track_code doesn't exceed 20 characters.
if (strlen("$major_code|_$track_code") > 20) {
form_error("major_code", t("The major and track code combined may not exceed 18 characters. Please shorten one or the other."));
return;
}
}