# How would you limit the number of choices in select element

**URL:** <https://community.hubspot.com/t/how-would-you-limit-the-number-of-choices-in-select-element/28015>\
**Category:** CMS Development\
**Tags:** starter\
**Created:** [November 14, 2020, 8:36pm UTC](https://community.hubspot.com/t/how-would-you-limit-the-number-of-choices-in-select-element/28015 "2020-11-14T20:36:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AminWejebe](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/aminwejebe/32/97852_2.png) [@AminWejebe](https://community.hubspot.com/u/AminWejebe)\
**Post date:** [November 14, 2020, 8:36pm UTC](https://community.hubspot.com/t/how-would-you-limit-the-number-of-choices-in-select-element/28015/1 "2020-11-14T20:36:42Z")

</div>

Hello!

I’m building a module but got stuck, I have a hubdb with a column of the type select and this column have 5 choices and I would like to have a select filter in my custom module but I would only wish to display 3 of those 5 choices. How would you go about doing that? Thanks in advance

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [November 16, 2020, 9:52am UTC](https://community.hubspot.com/t/how-would-you-limit-the-number-of-choices-in-select-element/28015/2 "2020-11-16T09:52:25Z")

</div>

Hi @AminWejebe,

Do you want to display 3 specific choices, or any 3 (i.e. the first 3). If any will do, you could add an if statement in your for loop like:

```lia-code-sample
{% set choices = hubdb_table_column(table_id, "choices").options %}
<select id="myFilter">
 <option selected="selected" value="all">Choose an option</option>
 {% for item in options %}
 {% if loop.index <= 3 %}
 <option value="{{item}}">{{item}}</option>
 {% endif %}
 {% endfor %}
</select>

```

But I could be more helpful if you copy/paste your code, as the above is assuming you’re pulling the choices directly from the HubDB.
