CMS Development

novaem
Member

HubDB & custom search

SOLVE

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
1 Accepted solution
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

HubDB & custom search

SOLVE

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 %}

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

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

2 Replies 2
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

HubDB & custom search

SOLVE

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 %}

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

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
sharonlicari
Community Manager
Community Manager

HubDB & custom search

SOLVE

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 @alyssamwilie @Kevin-C could you please advise or share some tips with @novaem

 

Thank you

Sharon 


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