#validate function doesn't get called
| Project: | Views Filter Block |
| Version: | 5.x-1.4 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Hi.
Drupal 5.x, Views 1.x. I have a view with 3 exposed filters. Using VFB for relocating the filters form in a block. So far, so good.
The need:
I have some field filters that I can't expose because the underlying fields aren't available in all the returned content types, so as soon as I expose the field (even with the filter being empty), the content types that have it not are filtered out.
My solution:
I left only the 'common' fields exposed. I would use the hook_form_alter to add some 'dummy' filter fields and process them afterwards. I mean, in case there's some value in the dummy fields, save it alogn the form info and modify the query via hook_pre_query later.
The problem:
I set the validate function or the submit function and they never get called. Relevant code:
function mymodule_form_alter($form_id, &$form) {
if ($form_id != 'views_filterblock'):
return;
endif;
$form['#validate']['my_function'] = array();
}
function my_function($form_id, $form_values) {
drupal_set_message("It works!", 'warning');
}I browsed the issue queue and found some related info, but none has helped me.
Maybe I don't understand quite well how FAPI+Views+VFB works together, since their form handling sounds confusing for me (ie. it uses "get" method instead of "post", 'form_id' and 'form_token' get stripped from $form, etc.).
Thanks in advance.
