HubDB & custom search

novaem
Member

Hello.

 

I need to make a search bar with a filter by a HubDB column, which I've done with this tutorial. I have a question if there is a way to place a search bar and a submit button to another page and show results as a dropdown list.

 

Or maybe I could modify the standart hubspot search so it can search by a hubdb field? Right now it has exactly the same functionality that I need except for the field it searches by.

0 Upvotes
2 Replies 2
sharonlicari
Community Manager

Hey @novaem 

 

Thank you for your question, could you please share the URL you are working on? It would be beneficial to the Community will be able to assist you. 

 

Hey @DanielSanchez @amwilie @Kevin-C could you please advise or share some tips with @novaem

 

Thank you

Sharon 


¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones!

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


amwilie
Key Advisor | Elite Partner

You can use javascript to send the search query on to the url on submit and then use that query to fill out the results. Something like:

 

$('form').on('submit', function() {
    var query = $(this).find('input').val();
    
    window.location.href = "https://www.yoururl.com?query=" + query;
});
{% set filter = "columnName__icontains="~request.query_dict.query|urlencode %} 

{% for row in hubdb_table_rows(<tableId>, filter ) %}
{% endfor %}

Alyssa Wilie

Web Developer at LyntonWeb

If this answer solved your question, please mark it as the solution!