Some help resolving a hook_search and form API problem?

Events happening in the community are now at Drupal community events on www.drupal.org.
james marks's picture

I have a form which consists of search results formatted as a table and themed as a form for which the validate and submit functions work correctly EXCEPT when this search results form is used with hook_search in which case neither the search results form's validate or submit functions are ever called.

hook_search appears to be bypassing the search results form's validate and submit functions entirely.

One part of the problem may be that when hook_search is used, the hook_search function is called 6 times (!) only one of which (#4) is to execute an actual search ($op = 'search'). I'm wondering if the subsequent calls wipe out the search results form's validate and submit calls.

After extensive testing I still cannot figure out how to solve this and I'm wondering if anyone familiar with the form API might be able to help me find a solution.

(The easiest solution might be to abandon the hook_search approach altogether which I'm about ready to do but I was hoping to keep the hook_search as part of the core search tabs.)

Any help would be greatly appreciated.

James