The following is code attempting to populate a dropdown menu with the custom inputs made by a user:
I get the following liquid error, and the dropdown becomes blank if i edit code to say options:[array]
Any suggestions? Thanks!
The following is code attempting to populate a dropdown menu with the custom inputs made by a user:
I get the following liquid error, and the dropdown becomes blank if i edit code to say options:[array]
Any suggestions? Thanks!
Hey @Spencer.Posner,
Instead of appending “;”, use a pipe “|” instead. The method options and option_values will only work with that.
Let us know if it works.
Unfortunately, the same results return. I also tried not splitting the array, but that did not work either.
It should work if you follow this logic:
{% assign my_array = "" %}
{% fori item in custom.categories %}
{% input item.cat %}
{% assign my_array = my_array | append:item.cat %}
{% unless forloop.last %}
{% assign my_array = my_array | append:"|" %}
{% endunless %}
{% endfori %}
{% input custom.some.dropdown as:select options:my_array %}
Same goes for the option_values. So you don’t need to split in the array; the pipes do that for you basically.