#176503 by chx and bennybobw: hidden profile fields cannot be required and cannot be put on the registration form, so we needed warnings on the editing form to not let admins save forms set with these combinations.

6.x
Gábor Hojtsy 2007-10-05 13:26:53 +00:00
parent 0e04fbd43d
commit 25465ee76e
1 changed files with 8 additions and 0 deletions

View File

@ -369,6 +369,14 @@ function profile_field_form_validate($form, &$form_state) {
if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'". $query_suffix, $args2))) {
form_set_error('name', t('The specified name is already in use.'));
}
if ($form_state['values']['visibility'] == PROFILE_HIDDEN) {
if ($form_state['values']['required']) {
form_set_error('required', t('A hidden field cannot be required.'));
}
if ($form_state['values']['register']) {
form_set_error('register', t('A hidden field cannot be set to visible on the user registration form.'));
}
}
}
/**