Using Hubl variables as parameters in hubl functions
**{% text "id_form" label='Id formulaire contact (1 pour chaque langue)', value='3f2b3ff8-693b-43b4-845c-b3b200908472', export_to_template_context=True %}**
{% for row in hubdb_table_rows .... %}
{% widget_block form "form_contact_reseau" form_follow_ups_follow_up_type='', response_redirect_id=306590405, form_to_use='**widget_data.id_form.value**', title="" , notifications_are_overridden=True, sfdc_campaign='', response_message='Thanks for submitting the form.', response_response_type='redirect', response_redirect_url='', overrideable=True, gotowebinar_webinar_key='', response_redirect_name='Homepage (http://www.hubspot.com/)', label='Form', response={message='Thank you for submitting the form.', redirect_url=''} %}
{% widget_attribute "notifications_override_email_addresses" is_json=True %}["**{{ row.email }}**"]{% end_widget_attribute %}
{% end_widget_block %}
{% endfor %}
How to integrate the two variables hubl in this function to be able to vary the notification email and the form.
I have a supplier table that returns an email, and I have 5 different form (compared to the language). I want to display a form according to the defined id_form parameter and that the form returns an email notification to the vendors email address in the table.
Can you help me, Thank you so much for your involvement.
Using Hubl variables as parameters in hubl functions
A couple things:
you shouldn’t set your widget_block inside the for loop… {% widget_block form "form_contact_reseau"... since the HUBL module will be attempting to set the same ID form_contact_reseau for each widget block which would be a duplicate.
I just tested this code so it should work… if you remove is_json=“true” - you can just pass a string with comma separated values
{% text "id_form" label='Id formulaire contact (1 pour chaque langue)', value='3f2b3ff8-693b-43b4-845c-b3b200908472', export_to_template_context=True %}
{% set loopy = ['Content', 'Social'] %}
{% widget_block form "form_contact_reseau" form_to_use='{{widget_data.id_form.value}}' %}
{% for row in loopy %}
{% set email1 = "email1@email.com" %}
{% set email2 = "email2@email.com" %}
{% set emailaddycompiledstring = '{{email1}}, {{email2}}' %}
{% widget_attribute "notifications_override_email_addresses" %}{{emailaddycompiledstring}}{% end_widget_attribute %}
{% endfor %}
{% end_widget_block %}