Is there a mutli-select widget I can use with export_to_template_context??
I'm using the following code in my page template <head> to generate a 'choice' select-box widget from the row NAMEs in my hubDB table, and exporting it to template_context
{% set array = [] %}
{% set rows = hubdb_table_rows(XXXXXXX) %}
{% for row in rows %}
{% set items = array.append(row.name) %}
{% endfor %}
{% set stringArray = array|join(', ') %}
{% choice "case_study" label='Choose the correct case study', choices='{{stringArray}}', no_wrapper=True, export_to_template_context=True %}
{% set choiceValue = widget_data.case_study.value|replace(' ', '%20') %}
{% set finalChoiceValue = "name=" ~ choiceValue %}
and then, in the module, this looks up that row using the finalChoiceValue value
{% for row in hubdb_table_rows(XXXXXX, finalChoiceValue) %}
<img src="{{ row.logo_sized.url }}" alt="{{ row.name }}" />
{% endfor %}
What I need is to do this same thing but to be able to select multiple rows, so like an array of checkboxes perhaps, instead of the "choice" select-box. Is this possible?
Aug 12, 20209:03 AM - edited Aug 12, 20209:06 AM
Guide | Partner
Is there a mutli-select widget I can use with export_to_template_context??
{% set choices = choicesArray|split(', ') %}
One thing you could do is experiment with is using a text field supported with good help text and documentation. In your help text explain how enter choices seperated by a comma. You can then use the field data and create your array off that.
You could also create a page with a simple multi select with a textarea box that autopopulates what they need to copy and paste in the module. Then link to this in the help text. This is a polyfill solution until HubSpot adds this field.