I am trying to dynamically populate the choices in a choice field.
I am building a list from a hubDB, and then joining the list to make a comma seperated string of choices ready to pass into the choice module declaration.
The code is in the Additional <head> markup section of my blog template.
Sadly I Get and error saying…
‘Error:Unexpected token [EndTag] when in state [InBody]’
And it wont let me publish the page. Is there any way i can get round this?
{% set currentList = [] %}
{% for row in hubdb_table_rows(1034058, “orderBy=random()”) %}
{{ currentList.append(row.name|striptags) }}
{% endfor %}
{% set currentString = currentList|join(‘,’) %}
{% choice “test” label=‘Test’, value=‘test0’, choices=‘{{ currentString }}’ export_to_template_context=true %}