Title: Issue with dynamic choice field rendering in HubSpot module

Hi everyone,
I’m trying to display dynamically editable fields in the quote editor for my users.

Goal:

  • Display a select field to let the user choose a value.
  • Depending on the selected value, render a different module.
  • The rendering should update dynamically so the user can preview the module instantly.

I’ve followed the official HubSpot docs:

:backhand_index_pointing_right: Problem:

Neither the choice field documentation nor the instructions for dynamically retrieving the value seem to work.
When the user changes the value, it has no effect — only the default value is ever loaded.
Here’s what I tried:

  • Created a choices field in my convention_display module.
  • Added it to modern.html with export_to_template_context=True.
  • Inspected the widget_data:
(SizeLimitingPyMap: {
 choix_contrat=confort, 
 definition_id=null, 
 export_to_template_context=true, 
 field_types={choix_contrat=choice}, 
 module_id=279203636427, 
 parent_widget_container=null, 
 path=/conventions/modules/convention_display, 
 smart_objects=null, 
 smart_type=NOT_SMART, 
 type=module, 
 wrap_field_tag=div
})

I can see choix_contrat=confort (the default value), but when I change the value in the editor, it always stays on “confort”.

Question:
Am I missing something here? Or is the documentation outdated? :thinking:

Thanks in advance for any help!

Hi @TCarbuccia ,

Hm this is still working for me (see screenshot below where I’m selecting the non-default value in the legacy quote template editor experience) and it’s returning the value.

Here’s the setup that I have:

  • Module with a choice field, internal name choice_field
  • Two options (option 1 which has internal value set to value 1, option 2 which has internal value set to value 2)
 {% module "module_with_choice_field" path="/theme/modules/test", label="test" export_to_template_context=true%}
 {% if widget_data.module_with_choice_field %}
 {{ widget_data.module_with_choice_field.choice_field }}
 {% endif %}

I don’t think I have enough context on your setup or your use of the choice HubL tag unfortunately to help further. I don’t think the choice HubL tag would work in this particular scenario based on my own tests. Let me know if I’m missing out something obvious here or if this is sufficient for you to conditionally display sections of your template based on the module selection!

Edit: we won’t be able to conditionally display the module in the legacy quote template editor sidebar based on my testing.