Creating a dynamic search form?

Hello!

I am fairly familiar with Bricks Builder however this is my first post on this forum. I want to create a search bar like the one below:

However mine will be slightly different as I only need category and course fields, when a category is selected then the course dropdown should populate with any children of that category. Each course will have its own page and when hitting the search button I want it to redirect to user to that courses page.

I have looked into the new filter options however they seem to be more designed for filtering product listing pages. And I have currently been trying to use a form to achieve this by populating the category dropdown with logic found here:

However I now need a way to populate the second dropdown based on what is selected in the first, which I fear may not be possible!

Any help would be massively appreciated :slight_smile: TIA!

Your best bet is the select and submit query filters as they are already designed to work exactly as you described if i understood you right.

Only possible limitation is it seems the submit filter redirect field doesn’t support dynamic data as the input suggest if not, you could write some snippet to handle the redirect. I’m sure the support team will have a solution for you. Send them an email with a link to this thread.

Hi Emmanuel!

Thank you for such a quick response!

The problem I am having with the Filter - Select is that they will require the courses to be listed somewhere on the page as a query loop from my understanding, I want this search bar to be on the homepage without having to list all of my courses on that page (Apologies I realise I didn’t mention this detail in my original post)

Unless I am mistaken I would need a query loop somewhere on the homepage that would list all courses and categories. (Although thinking of this I could just have them as a display: none)

Edit

The other problem I have is populating the second filter select based off what is selected in the first select filter. For example if it was a car website the first select filter would be Model and the second would be Make

I will drop the support team a message thank you!

Yes, you can actually add an empty div, apply your course query to it and set it to display: none, visibilty: hidden and select this loop as your filter target query. It should work this way.

This should be sorted out if you use the empty div approach i suggested above.

Thank you for your help on this @emmanuelson I managed to get the two select filters working however,

Unfortunately after being in contact with support there is no way of having the submit button take a dynamic piece of data such as a post URL, so what I am trying to achieve above is not possible within bricks! I can have it redirect to a new search page, but not to a single post unfortunately.