Skip to content

Commit

Permalink
Merge pull request #15521 from uberbrady/improve_country_selector
Browse files Browse the repository at this point in the history
Fix selected-index of Countries drop-down [fd-44144]
  • Loading branch information
snipe authored Sep 18, 2024
2 parents 154d5d8 + f963b9a commit 04bb3ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/macros/macros.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@

foreach ($countries_array as $abbr => $country) {

// We have to handle it this way to handle deprecication warnings since you can't strtoupper on null
// We have to handle it this way to handle deprecation warnings since you can't strtoupper on null
if ($abbr!='') {
$abbr = strtoupper($abbr);
}

// Loop through the countries configured in the localization file
$select .= '<option value="'.$abbr.'" selected="selected" role="option" '.(($selected == $abbr) ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$country.'</option> ';
$select .= '<option value="' . $abbr . '" role="option" ' . (($selected == $abbr) ? ' selected="selected" aria-selected="true"' : ' aria-selected="false"') . '>' . $country . '</option> ';

}

// If the country value doesn't exist in the array, add it as a new option and select it so we don't drop that data
if (!in_array($selected, $countries_array)) {
if (!array_key_exists($selected, $countries_array)) {
$select .= '<option value="' . $selected . '" selected="selected" role="option" aria-selected="true">' . $selected .' *</option> ';
}

Expand Down

0 comments on commit 04bb3ee

Please sign in to comment.