function hook_field_validate


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 field.api.php hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors)
cle7 field.api.php hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors)
elmsmedia7 field.api.php hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors)
icor7 field.api.php hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors)
meedjum_blog7 field.api.php hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors)
mooc7 field.api.php hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors)

Validate this module's field data.

If there are validation problems, add to the $errors array (passed by reference). There is no return value.


$entity_type: The type of $entity.

$entity: The entity for the operation.

$field: The field structure for the operation.

$instance: The instance structure for $field on $entity's bundle.

$langcode: The language associated with $items.

$items: $entity->{$field['field_name']}[$langcode], or an empty array if unset.

$errors: The array of errors (keyed by field name, language code, and delta) that have already been reported for the entity. The function should add its errors to this array. Each error is an associative array with the following keys and values:

  • error: An error code (should be a string prefixed with the module name).
  • message: The human readable message to be displayed.

Related topics

15 functions implement hook_field_validate()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

date_field_validate in sites/all/modules/ulmus/date/
Implements hook_field_validate().
email_field_validate in sites/all/modules/ulmus/email/email.module
Implements hook_field_validate().
entityreference_field_validate in sites/all/modules/ulmus/entityreference/entityreference.module
Implements hook_field_validate().
entity_form_field_validate in includes/
Attaches field API validation to entity forms.
field_hidden_field_validate in sites/all/modules/ulmus/field_hidden/field_hidden.module
Validation of field items upon form submission.

... See full list

1 invocation of hook_field_validate()
field_attach_validate in modules/field/
Perform field validation against the field data in an entity.


modules/field/field.api.php, line 396


function hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
  foreach ($items as $delta => $item) {
    if (!empty($item['value'])) {
      if (!empty($field['settings']['max_length']) && drupal_strlen($item['value']) > $field['settings']['max_length']) {
        $errors[$field['field_name']][$langcode][$delta][] = array(
          'error' => 'text_max_length',
          'message' => t('%name: the value may not be longer than %max characters.', array('%name' => $instance['label'], '%max' => $field['settings']['max_length'])),



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.