{% set type = type|default(form_value('type')) %} {% set countryId = form_value(type ~ '_country_id') %} {% set stateId = form_value(type ~ '_state_id') %} {# If only one country is available it can be preselected. #} {% if (__SELF__.countries | length) == 1 %} {% set countryId = (__SELF__.countries | keys)[0] %} {% endif %} {% set id = type ~ '_country_id' %}
{{ form_select_country(id, countryId, { id: id, 'class': 'form-select', emptyOption: ('offline.mall::frontend.select' | trans ), 'data-request': 'onInit', 'data-request-data' : ("type: '" ~ type ~ "'"), 'data-request-update': { (__SELF__ ~ '::countrystate'): ('#countryState_' ~ type) } }) }}
{% if __SELF__.useState %} {% set id = type ~ '_state_id' %}
{{ form_select_state(id, countryId, stateId, { id: id, 'class': 'form-select', emptyOption: ('offline.mall::frontend.select' | trans ), }) }}
{% endif %}