Quick way to translate the value attribute #1443
-
Is there a quick way to apply |t('freeform') to the option "value" attribute of all dropdown fields? I have to build a pretty complex form with a lot of option and it would be super useful if I could use OPTION_1, OPTION_2 ecc. strings and then translate these with freeform.php. This actually works except for the fields values which are obviously also visible in the "submission" section and in the notification emails. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @samuel-clara, This should automatically happen when using <label>My Dropdown Field</label>
<select name="{{ myDropdown.handle }}">
{% for option in myDropdown.options %}
<option value="{{ option.value }}" {{ option.value in field.value ? "selected" }}>{{ option.label|t('freeform') }}</option>
{% endfor %}
</select> If you're referring to something different, can you share what your template code looks like and elaborate? 🙂 |
Beta Was this translation helpful? Give feedback.
-
Unfortunately the actual option value cannot be translated for option-based fields like Dropdowns. This is because Freeform expects values that are pre-configured in the form builder. You have two options to workaround this issue:
|
Beta Was this translation helpful? Give feedback.
Unfortunately the actual option value cannot be translated for option-based fields like Dropdowns. This is because Freeform expects values that are pre-configured in the form builder.
You have two options to workaround this issue: