@@ -76,4 +76,49 @@ UPGRADE FROM 2.0 to 2.1
76
76
If you don't want to set the ` Valid ` constraint, or if there is no reference
77
77
from the data of the parent form to the data of the child form, you can
78
78
enable BC behaviour by setting the option "cascade_validation" to ` true ` on
79
- the parent form.
79
+ the parent form.
80
+
81
+ * In the template of the choice type, instead of a single "choices" variable
82
+ there are now two variables: "choices" and "choice_labels".
83
+ "choices" contains the choices in the values (before they were in the keys)
84
+ and "choice_labels" contains the matching labels. Both arrays have
85
+ identical keys.
86
+
87
+ Before:
88
+
89
+ {% for choice, label in choices %}
90
+ <option value="{{ choice }}"{% if _form_is_choice_selected(form, choice) %} selected="selected"{% endif %}>
91
+ {{ label }}
92
+ </option>
93
+ {% endfor %}
94
+
95
+ After:
96
+
97
+ {% for index, choice in choices %}
98
+ <option value="{{ choice }}"{% if _form_is_choice_selected(form, choice) %} selected="selected"{% endif %}>
99
+ {{ choice_labels[index] }}
100
+ </option>
101
+ {% endfor %}
102
+
103
+ * The strategy for generating the HTML attributes "id" and "name"
104
+ of choices in a choice field has changed. Instead of appending the choice
105
+ value, a generated integer is now appended by default. Take care if your
106
+ Javascript relies on that. If you can guarantee that your choice values only
107
+ contain ASCII letters, digits, letters, colons and underscores, you can
108
+ restore the old behaviour by setting the option "index_strategy" of the
109
+ choice field to ` ChoiceList::COPY_CHOICE ` .
110
+
111
+ * The strategy for generating the HTML attributes "value" of choices in a
112
+ choice field has changed. Instead of using the choice value, a generated
113
+ integer is now stored. Again, take care if your Javascript reads this value.
114
+ If your choice field is a non-expanded single-choice field, or if
115
+ the choices are guaranteed not to contain the empty string '' (which is the
116
+ case when you added it manually or when the field is a single-choice field
117
+ and is not required), you can restore the old behaviour by setting the
118
+ option "value_strategy" to ` ChoiceList::COPY_CHOICE ` .
119
+ of choices in a choice field has changed. Instead of appending the choice
120
+ value, a generated integer is now appended by default. Take care if your
121
+ Javascript relies on that. If you can guarantee that your choice values only
122
+ contain ASCII letters, digits, letters, colons and underscores, you can
123
+ restore the old behaviour by setting the option "index_strategy" of the
124
+ choice field to ` ChoiceList::COPY_CHOICE ` .
0 commit comments