# Filtering HubDB elements with HTML Checkboxes - follow up

**URL:** <https://community.hubspot.com/t/filtering-hubdb-elements-with-html-checkboxes-follow-up/20768>\
**Category:** CMS Development\
**Tags:** design-manager, hubdb, javascript\
**Created:** [May 11, 2020, 9:08pm UTC](https://community.hubspot.com/t/filtering-hubdb-elements-with-html-checkboxes-follow-up/20768 "2020-05-11T21:08:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FedeColap](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/fedecolap/32/58551_2.png) [@FedeColap](https://community.hubspot.com/u/FedeColap)\
**Post date:** [May 11, 2020, 9:08pm UTC](https://community.hubspot.com/t/filtering-hubdb-elements-with-html-checkboxes-follow-up/20768/1 "2020-05-11T21:08:23Z")

</div>

Howdy Community,

I understand there is a previous post for the same issue (

[https://community.hubspot.com/t5/CMS-Development/Filtering-HubDB-elements-with-HTML-Checkboxes/m-p/297319](https://community.hubspot.com/t5/CMS-Development/Filtering-HubDB-elements-with-HTML-Checkboxes/m-p/297319) ) but I don’t believe a solution has been found.

I have tried many options, but figured some help would get me going. My thoughts have been 2:

1) try to set the filters each time I make a query to HubDB (similarly to the famous Real Estate tutorial, and set in the aforementioned post) or

2) make only one giant query to retrieve the data from HubDb and then filter them (similarly to React).

The first method is easier said than done, I have though about entering a “submit button” to submit all the checked boxes at once, but the line

```
 \`{% set typequery = typequery ~ "&type="~request.query\_dict.type\|urlencode %}\`

```

would give me a URL like this:

```
 \`?type=1&type=4&topic=1&topic=2\`,

```

which does not work. Looking around I have found that a correct URL should be

```
 \`?type=1+4&topic=1+2\`

```

but I am not sure how to get to that uRL encoding.

The second method has its own challenges. My line of thought was this:

first, in the JS panel create an empty array;

second, `document.querySelectorAll(`input[name=“${name}”]:checked`)` and push them into the array;

third, display each element of the array, from the HTML/hubl panel.

Unfortunately, I have not figured out yet how to fire a function and use a variable from the JS panel to the HTML/hubl panel.

Any help or suggestion is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![sharonlicari](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sharonlicari/32/101479_2.png) [@sharonlicari](https://community.hubspot.com/u/sharonlicari)\
**Post date:** [May 13, 2020, 4:28pm UTC](https://community.hubspot.com/t/filtering-hubdb-elements-with-html-checkboxes-follow-up/20768/2 "2020-05-13T16:28:08Z")

</div>

Hey @FedeColap

Thank you for the information provided. I’ll tag a few experts  
 ![16x16_smiley-happy.png.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/2/22d5e40d253def47f5f4ea7f0e3e70be19010689.png)

Hey @Kevin-C @prosa @Anton do you have any thoughts you’d like to share with @FedeColap

Thank you

Sharon

---

<div class="post-metadata">

**Author:** ![FedeColap](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/fedecolap/32/58551_2.png) [@FedeColap](https://community.hubspot.com/u/FedeColap)\
**Post date:** [May 19, 2020, 1:23pm UTC](https://community.hubspot.com/t/filtering-hubdb-elements-with-html-checkboxes-follow-up/20768/3 "2020-05-19T13:23:55Z")

</div>

Hi @sharonlicari thanks for giving a thought and calling @Kevin-C and @prosa on this. For the records, since i found still challenging building the actual query to send as a get request, I ended up displaying the whole HubDB table at the beginning, and then working in JS/jQuery to hide and show results, so no queries each time the 2 filters are combined.

Thank you for the suggestions, have a great day!

---

<div class="post-metadata">

**Author:** ![prosa](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/prosa/32/4387_2.png) [@prosa](https://community.hubspot.com/u/prosa)\
**Post date:** [May 13, 2020, 4:54pm UTC](https://community.hubspot.com/t/filtering-hubdb-elements-with-html-checkboxes-follow-up/20768/4 "2020-05-13T16:54:06Z")

</div>

Hi there, I would recommend that you use Hubl to filter the db and set it to a js variable inside of a script tag. then use your js section to work with it. using react you can pull that data using window.VAR

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [May 13, 2020, 5:19pm UTC](https://community.hubspot.com/t/filtering-hubdb-elements-with-html-checkboxes-follow-up/20768/5 "2020-05-13T17:19:29Z")

</div>

Thanks @sharonlicari and Hello @FedeColap

So i’ve got a rather ellegant (if i do say so myself) solution for multiple checkbox filter with hubDB. But to be honest I’m not decided on releasing it as a paid article or free… shoot me a DM maybe we can work something out.

But anyway I can give you a few pointers.

I would get, build, and submit the URL with JS/jQuery on the front end. I always feel more comforable in JS over hubl/jinja.
