Does anyone know how i can add search parameters to a search field using the select field like this:
@sokijaja - welcome to Webflow.
I’ve never done it but it appears you could do it by altering the url like so:
https://www.louisianajobconnection.com/search?query=marketing
https://www.louisianajobconnection.com/search?query=sales
Thanks Louisiana Job Connection for being the guinea pig.
So, you would probably not use the standard search form field, but a few custom fields. A combination of a text input, and two select boxes like in your screenshot.
Then using a bit of jQuery on click (of the button) you would concatenate the search terms like this:
text-input+category+location
I’m guessing the code would be something like this:
$('.submit-btn').on('click'), function(e) {
e.preventDefault();
var query = '';
// search all inputs of form with id 'search;
$('#search input, #search select').each(function(index) {
query = query + $(this).val() + '+'
});
// trim trailing '+' from search string
query = query.replace(/[+]\s*$/, "");
var searchURL = '/search' + query
location.href = searchURL;
});
The code has not been tested and will probably need to be changed based on the classes / ids you use on your site.