On our instance of HUBL we use an array and a choice selector to be able to create a 'repeater' style element where you are able to select the number of times a block repeats. The code is as follows:
Until Friday this code worked as expected, showing numbers 1 to 8 in the dropdown when editing a Hubspot page. On Friday however this functionality has stopped working and the dropdown now just shows 1 option: "{{ text_image_rows }}":
I contacted Hubspot Support and they were unable to offer me any reason as to why this may be happening - or even if it was a bug or an intended change. Could anyone provide some more information on this as our website is largely built around this repeater concept.
Sep 30, 20199:21 AM - edited Sep 30, 20199:27 AM
Member
HUBL not rendering array in choice selector
SOLVE
Hi Stephanie, thanks for getting back to me!
I do still want to use a variable as this variable can sometimes be used in multiple places within a template.
It seems to work when removing the quotation marks so thank you for providing that solution. It definitely has worked for years with them so must have been a recent change. Do you know why this has changed and if there is any chance it will change back? As mentioned we use this functionality very heavily across our website so updating it everywhere will take a lot of time.
Thanks
EDIT:
After doing some further testing it seems that although this does cause the options to render in the dropdown it stops the variable from being exported to the template context for use in other places, and if I place the export_in_template_context attribute before the choices attribute in the HUBL tag then it stops rendering the options again.
Hi Stephanie, not sure if you saw my edit on my last post but I jumped the gun a little on my reply and your solution unfortuantely doesn't quite solve my issue. Here is my edit again to explain why:
After doing some further testing it seems that although this does cause the options to render in the dropdown it stops the variable from being exported to the template context for use in other places, and if I place the export_in_template_context attribute before the choices attribute in the HUBL tag then it stops rendering the options again.
Do you know if there is any way I can edit the code so that it will export the choice variable to the template context?