#107200countrySelect viewhelper doesn't pre-select the current value
Description
<f:form.countrySelect property="country" />
Doesn’t select the country that is stored in the country property (Domain model with Country class property)
In the viewhelper the code
$options = $this->createOptions($validCountries);
$selectedValue = $this->getValueAttribute();
$tagContent = $this->renderPrependOptionTag();
foreach ($options as $value => $label) {
$tagContent .= $this->renderOptionTag($value, $label, $value === $selectedValue);
}
produces an array with options where the key is the two-letter ISO code.
The selectedValue however is a Country object and the method getValueAttribute() tries to get an identifier by calling convertToPlainValue(). Unfortunately that method isn’t aware of Country objects yet and simply returns the entire object instead of the alpha2 property.
Reviews 1
Related issues 2
History 48
-
Garvin Hicking changed Related to #99911 <span data-processor="relativetime" data-value="2025-08-04T14:51:55+00:00" > 08/04/25, 14:51 </span>
-
Garvin Hicking changed Related to #104997 <span data-processor="relativetime" data-value="2025-08-04T14:52:13+00:00" > 08/04/25, 14:52 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 90238 status
NewUnder Review <span data-processor="relativetime" data-value="2025-08-04T14:56:33+00:00" > 08/04/25, 14:56 </span> -
Gerrit Code Review pushed patch set 2 for main to change 90238 <span data-processor="relativetime" data-value="2025-08-04T14:57:30+00:00" > 08/04/25, 14:57 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 90238 <span data-processor="relativetime" data-value="2025-08-04T14:58:42+00:00" > 08/04/25, 14:58 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 90238 <span data-processor="relativetime" data-value="2025-08-04T16:06:44+00:00" > 08/04/25, 16:06 </span>
-
Garvin Hicking commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-08-05T09:30:08+00:00" > 08/05/25, 09:30 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T13:58:07+00:00" > 12/02/25, 13:58 </span>
Applied in changeset commit:107949e41fa7b9b19e6341c77075defd28d4283a.