CMS Development

ramanverma2005
Participant

HUBDB multiple selection option in dropdown in custom module

SOLVE

How I can do this website filter thing in HUBDB but with multiple selection option in dropdown in custom module

 

https://www.intapp.com/resources/
Note : this is single option selection we need multiple selection 

0 Upvotes
1 Accepted solution
piersg
Solution
Key Advisor

HUBDB multiple selection option in dropdown in custom module

SOLVE

If I understand your question correctly, you want to display all the options from a multi-selection column as a dropdown select, right?

 

In that case:

 

 

<select name="type" form="form_id" onChange="this.form.submit()">
<option value="show-all">Show All</option>
{% set types = hubdb_table_column([TABLE ID], [COLUMN NAME]).options %}
{% for choice in types %}
{% set type_list = type_list~choice.id|list %}
{% if choice.id == request.query_dict.[COLUMN NAME] %}
<option selected="selected" value="{{ choice.id }}">{{ choice.name }}</option>
{% else %}
<option value="{{ choice.id }}">{{ choice.name }}</option>
{% endif %}
{% endfor %}
</select>

 

You can find more info here: https://designers.hubspot.com/docs/tutorials/how-to-build-a-real-estate-listing-with-hubdb

 

You'd also need the logic to handle the query parameters (detailed in the above link) so that the page loads the correct information based on the selected filter.

View solution in original post

2 Replies 2
ramanverma2005
Participant

HUBDB multiple selection option in dropdown in custom module

SOLVE

Hi @piersg  I want to show all the rows from hubdb table for an examples I have added all the countries in hubdb table in name column "Coutry" as text field now I want name field data as multi-select dropdown in custom module so that user can select multiple records from select dropdown

0 Upvotes
piersg
Solution
Key Advisor

HUBDB multiple selection option in dropdown in custom module

SOLVE

If I understand your question correctly, you want to display all the options from a multi-selection column as a dropdown select, right?

 

In that case:

 

 

<select name="type" form="form_id" onChange="this.form.submit()">
<option value="show-all">Show All</option>
{% set types = hubdb_table_column([TABLE ID], [COLUMN NAME]).options %}
{% for choice in types %}
{% set type_list = type_list~choice.id|list %}
{% if choice.id == request.query_dict.[COLUMN NAME] %}
<option selected="selected" value="{{ choice.id }}">{{ choice.name }}</option>
{% else %}
<option value="{{ choice.id }}">{{ choice.name }}</option>
{% endif %}
{% endfor %}
</select>

 

You can find more info here: https://designers.hubspot.com/docs/tutorials/how-to-build-a-real-estate-listing-with-hubdb

 

You'd also need the logic to handle the query parameters (detailed in the above link) so that the page loads the correct information based on the selected filter.