Custom select drop boxes search form
Permalink
I'm in a desperate need to make a search form similar to this html:
which will search the website contents based on the selected values rather than a single 'query' value the existing search block uses.
Will greatly appreciate your help.
Thank you.
<?php <form name="search_form" action="whatever_the_action_should_be" method="get"> <select name="select1"> <option>x <option>y <option>z </select> <select name="select2"> <option>x <option>y <option>z </select> ?>
which will search the website contents based on the selected values rather than a single 'query' value the existing search block uses.
Will greatly appreciate your help.
Thank you.
To do this, you would need to create a custom view for the search block. The trick would be (and I may not be fully understanding what you want to do, so help me out if I don't), concatenating those two strings. If I were trying to do this, I'd probably just use Javascript rather than modify the controller of the search block. Make sense?
Yes, I've made my custom search form with select boxes in 2 different ways: overriding the existing search block and creating my own new block. Making the html form itself is not an issue. The problem is how do I send those multiple values from select boxes when the Submit button is pressed because I couldn't override the search file (wherever it is, after 2 weeks I still can't figure out which particular one actually receives the 'query' value and does the search).
I thought of concatenating the values with JavaScript but this is not fool proof as some people may have JavaScript turned off. A cleaner solution is to modify/override the database search query function.
As to what exactly I'm trying to do is (looking at my example form above), I want the database to search the site based on 'select1' and 'select2' values.
If there are no other options except for JavaScript, where do I put it? In the same 'view.php' file as the html form or there's a special place for JS files?
I thought of concatenating the values with JavaScript but this is not fool proof as some people may have JavaScript turned off. A cleaner solution is to modify/override the database search query function.
As to what exactly I'm trying to do is (looking at my example form above), I want the database to search the site based on 'select1' and 'select2' values.
If there are no other options except for JavaScript, where do I put it? In the same 'view.php' file as the html form or there's a special place for JS files?