{% set countryId = countryId|default(form_value('country_id')) %} {% set stateId = stateId|default(form_value('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-update': { (__SELF__ ~ '::countrystate'): '#countryState' } }) }}
{% if __SELF__.useState %} {% set id = type ~ 'state_id' %}
{{ form_select_state(id, countryId, stateId, { emptyOption: ('offline.mall::frontend.select' | trans ), id: id, 'class': 'form-select', }) }}
{% endif %}