* create more than 1 validators for the sam field
only the last validator will determine the result

Comments

geek-merlin’s picture

StatusFileSize
new1.21 KB

it looks like field_validation_field_attach_validate() needs some kind of rewrite anyway so i just did a quick fix that is not too elegant but seems to do its job fine.

as of a rewrite i wonder about the usage note for hook_field_attach_validate(), although i do not fully get the implications, but it looks like this hook is for field validation, not for field instance validation. don't see the implications though.

This function does not perform field widget validation on form submissions. It is intended to be called during API save operations. Use field_attach_form_validate() to validate form submissions.

so here's the fix first.

g089h515r806’s picture

Status: Active » Reviewed & tested by the community

I have rewrite the code, now it works. module_invoke_all does not work here, so i call it directly.
Thanks axel.rutz.

foreach (module_implements("field_validation_validate") as $module) {
  $function = $module . '_' . "field_validation_validate";
  if (function_exists($function)) {
    $function($rule['validator'], $rule, $langcode, $items,  $errors);
  }
}
ericduran’s picture

Status: Reviewed & tested by the community » Fixed

Changing status to fix, since this was already added to the repo.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.