function field_attach_form_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_attach_form_validate($entity_type, $entity, $form, &$form_state, $options = array())
cle7 field_attach_form_validate($entity_type, $entity, $form, &$form_state, $options = array())
elmsmedia7 field_attach_form_validate($entity_type, $entity, $form, &$form_state, $options = array())
icor7 field_attach_form_validate($entity_type, $entity, $form, &$form_state, $options = array())
meedjum_blog7 field_attach_form_validate($entity_type, $entity, $form, &$form_state, $options = array())
mooc7 field_attach_form_validate($entity_type, $entity, $form, &$form_state, $options = array())

Perform field validation against form-submitted field values.

There are two levels of validation for fields in forms: widget validation, and field validation.

  • Widget validation steps are specific to a given widget's own form structure and UI metaphors. They are executed through FAPI's #element_validate property during normal form validation.
  • Field validation steps are common to a given field type, independently of the specific widget being used in a given form. They are defined in the field type's implementation of hook_field_validate().

This function performs field validation in the context of a form submission. It converts field validation errors into form errors on the correct form elements. Fieldable entity types should call this function during their own form validation function.


$entity_type: The type of $entity; e.g. 'node' or 'user'.

$entity: The entity being submitted. The 'bundle', 'id' and (if applicable) 'revision' keys should be present. The actual field values will be read from $form_state['values'].

$form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.

$form_state: An associative array containing the current state of the form.

array $options: An associative array of additional options. See _field_invoke() for details.

Related topics

10 calls to field_attach_form_validate()
accessibility_test_add_form_validate in sites/all/modules/ulmus/accessibility/accessibility.module
Validate callback for saving accessibility test entities.
accessibility_test_edit_form_validate in sites/all/modules/ulmus/accessibility/accessibility.module
entity_form_field_validate in includes/
Attaches field API validation to entity forms.
field_collection_field_widget_embed_validate in sites/all/modules/ulmus/field_collection/field_collection.module
FAPI validation of an individual field collection element.
field_test_entity_nested_form_validate in modules/field/tests/
Validate handler for field_test_entity_nested_form().

... See full list


modules/field/, line 837
Field attach API, allowing entities (nodes, users, ...) to be 'fieldable'.


function field_attach_form_validate($entity_type, $entity, $form, &$form_state, $options = array()) {
  // Validate $options since this is a new parameter added after Drupal 7 was
  // released.
  $options = is_array($options) ? $options : array();

  // Extract field values from submitted values.
  _field_invoke_default('extract_form_values', $entity_type, $entity, $form, $form_state);

  // Perform field_level validation.
  try {
    field_attach_validate($entity_type, $entity, $options);
  catch (FieldValidationException $e) {
    // Pass field-level validation errors back to widgets for accurate error
    // flagging.
    foreach ($e->errors as $field_name => $field_errors) {
      foreach ($field_errors as $langcode => $errors) {
        $field_state = field_form_get_state($form['#parents'], $field_name, $langcode, $form_state);
        $field_state['errors'] = $errors;
        field_form_set_state($form['#parents'], $field_name, $langcode, $form_state, $field_state);
    _field_invoke_default('form_errors', $entity_type, $entity, $form, $form_state, $options);



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.