function userreference_autocomplete_validate in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 6.3 modules/userreference/userreference.module \userreference_autocomplete_validate()
- 6.2 modules/userreference/userreference.module \userreference_autocomplete_validate()
Validate an autocomplete element.
Remove the wrapper layer and set the right element's value.
1 string reference to 'userreference_autocomplete_validate'
- userreference_autocomplete_process in modules/
userreference/ userreference.module - Process an individual element.
File
- modules/
userreference/ userreference.module, line 411 - Defines a field type for referencing a user from a node.
Code
function userreference_autocomplete_validate($element, &$form_state) {
$field_key = $element['#columns'][0];
$user = $element['#value'][$field_key];
$uid = NULL;
if (!empty($user)) {
$uid = db_result(db_query("SELECT uid FROM {users} WHERE name = '%s'", $user));
}
form_set_value($element, $uid, $form_state);
}