Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
kenorb CreditAttribution: kenorb commentedI've tried to do some workaround like:
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
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedWhy 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.
Comment #3
kenorb CreditAttribution: kenorb commentedIn 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).
Comment #3.0
kenorb CreditAttribution: kenorb commented1
Comment #4
kenorb CreditAttribution: kenorb commentedComment #5
MustangGB CreditAttribution: MustangGB commented