[development] custom search form

Doug Green douggreen at douggreenconsulting.com
Tue Nov 6 14:57:56 UTC 2007


So if you want to replace the search for that normally gets themed in 
the header, implement search_theme_form.  This is the second time I've 
had to tell someone this today.  There doesn't appear to be an api page 
on it :(  But you can see my example as it relates to VFS 
http://drupal.org/node/189531 (I know you don't want to use VFS, but the 
example still applies, just return $form).

Feijó wrote:
> I did read all information about *_search hooks
>
> I found that line "If your module needs to provide a more complicated 
> search form, then you need to implement it yourself without 
> hook_search(). In that case, you should define it as a local task 
> (tab) under the /search page (e.g. /search/mymodule) so that users can 
> easily find it." in http://api.drupal.org/api/group/search/5
>
> Thats my case, I'm not working in nodes!! I'm integrating information 
> stored in Firebird, its almost another site, old one, and I'm updating 
> it inside drupal, to centralize all information on my intranet.
>
> I simple need a Form (already built) to send the data after click on 
> Submit, that data need to be recieved it in some place... where? I 
> have to work with $_POST[] ? Or there it is a better drupal way?
>
> Here something I did:
>
>
> function mymodule_myfunc($id='') {
>
>  if (!$_POST['ok'])  // if I remove this if, after submit, the page 
> gets blank!
>    $content .= drupal_get_form('mymodule_myfunc_form');
>
>  $content .= theme_table($header, $rows);
>  return $content;
> }
>
> function mymodule_myfunc_form_submit($form_id, $form_values) {
>  drupal_set_message(print_r($form_values,1));  // just to see something
>  //return 'test';
> }
>
>
>
> Thanks
>
>
> baita abraço
> Feijó
>
>
>
> ----- Original Message ----- From: "Earnie Boyd" 
> <earnie at users.sourceforge.net>
> To: <development at drupal.org>
> Sent: Tuesday, November 06, 2007 10:49 AM
> Subject: Re: [development] custom search form
>
>
> Quoting Feijó <patrao at legendas.feijo.info>:
>
>> Hi Domas,
>>
>>
>> I just looked at views_fastsearch
>>
>> I cant use that, I cant use views.  I need to implement my own form 
>> and my own search (set the SQL with values from the form, get the 
>> result and show as a theme_form).
>>
>> Can you or someone in this group can point me the direction?
>>
>
> http://api.drupal.org/api/function/hook_search/5
>
> If you start typing the word ``search'' in the search box on the API
> documentation page you'll get a list of a few more items to look at.
>
> Earnie -- http://for-my-kids.com/
> -- http://give-me-an-offer.com/
>
>
>


-- 
Doug Green
douggreen at douggreenconsulting.com
904-583-3342

Bringing Ideas to Life with Software Artistry and Invention...



More information about the development mailing list