I'm totally stuck on this one. For my homepage, I've almost managed to create a great theme, but I'm stuck on the only thing left on my to-do-list.
The advanced search form. This is what I want to achieve:
• Remove the "first" submit button (the one in the basic search).
• Add an onclick="blah();" on the basic search text field.
• Add a
around the basic search part and a
around the other part, to be able to either show the basic or the advanced search, not both at the same time.
• Add a link in the advanced search part ("Basic search"), which while clicked, makes the advanced search form collapse and show the basic search form again.
• Change the "Advanced search" label/link thing a bit...
The presentation part, html/javascript/css, is no problem. But getting Drupal to change the advanced search thing seems too hard for me.
• The form can be hard-coded in php. There's no need for other dynamics than the adding/removing of taxonomies. My theme is not likely to show up on other sites in its present form.
What I've found out and tried:
I've found the search_view function (search.module), that calls the basic form, and node_form_alter (node.module), that adds the advanced search part to it. But I wasn't able to add a working theme_form_alter to my theme. Is that even possible?
I also tried to replace the $output = drupal_get_form('search_form', NULL, $keys, $type); line with a call to a theme function. I get the form exactly the way I want, but when searching, Drupal either just silently ignores the search and displays the form again, or whines about "Form validation failed".
Comments
My solution
Ok, so after some work, I came up with this solution, with modified search.module and node.module.
In search.module I modified function search_form()
This:
Into this:
And in node.module I changed function node_form_alter():
There are javascript functions and styles as well, but I won't present them here for now.
Is it really not possible to alter a form from the template.php file instead of changing the drupal modules? (I tried but didn't get it to work)
Customize advanced search form
node_form_alter
http://api.drupal.org/api/function/node_form_alter
hook_form_alter
http://api.drupal.org/api/function/hook_form_alter/6
----
Darly
just found this
just found this here:
http://drupal.org/project/search_block
Thanks i was searching for
Thanks i was searching for it.
The only source of knowledge is experience. ~ Albert Einstein.
How to make some search
How to make some search criteria in advance search page?
like http://www.bekas.com/ads/search/adv
if we type keyword and select options all search result will match with search criteria...