When I'm testing submission of standard node, hook_field_attach_validate is called.
I've added some field validation rules using field_validation module, but any of them work, because hook_field_attach_validate is not invoked.

Backtrace:
drupal_get_form => drupal_build_form => drupal_process_form => drupal_validate_form => _form_validate => form_execute_handlers => node_form_validate => entity_form_field_validate => field_attach_form_validate => field_attach_validate => field_validation_field_attach_validate

When testing ctools wizard (e.g. submit from step-2 to step-3), hook_field_attach_validate is not called.

Comments

kenorb’s picture

I've tried to do some workaround like:

// ctools step callback
$form['#validate'][] = 'foo_form_field_validate';
...
/**
 * Additional validation form
 */
function foo_form_field_validate($form, &$form_state) {
  $node = ctools_object_cache_get('foo', 'node'); // get the latest node object from the cache
  field_attach_form_validate('node', $node, $form, $form_state);
} 

but it's validating the whole form (all fields), not the current fields on the page.

I was testing it with newly created plugin for field_validation available here: #1672624: Validating end date versus start date when having separate fields

merlinofchaos’s picture

Why would it be? These are all just normal FAPI forms and it won't call any validation that you don't tell it to call.

kenorb’s picture

Title: hook_field_attach_validate is not called on multistep wizard form » How to use hook_field_attach_validate in multistep wizard form
Category: bug » support

In that case the question is, how to use hook_field_attach_validate to validate only specified multistep page, instead of the whole form (all fields).

kenorb’s picture

Issue summary: View changes

1

kenorb’s picture

Priority: Normal » Minor
Issue summary: View changes
MustangGB’s picture

Status: Active » Closed (outdated)