diff --git a/application/models/Stations.php b/application/models/Stations.php index 66d2d6ac6..51ad58775 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -114,11 +114,28 @@ class Stations extends CI_Model { $state = xss_clean($this->input->post('station_state', true)); } - // Check if DXCC is USA, Alaska or Hawaii. If not true, we clear the County field due to complex adif specs - if (($this->input->post('dxcc') == 291 || $this->input->post('dxcc') == 006 || $this->input->post('dxcc') == 110) && $this->input->post('station_cnty') !="") { - $county = xss_clean($this->input->post('station_cnty', true)); - } else { - $county = ''; + // Check if DXCC is USA, Alaska or Hawaii, RU, UR, and others with subareas. + // If not true, we clear the County field due to complex adif specs + switch ($this->input->post('dxcc')) { + case 6: + case 110: + case 291: + case 15: + case 54: + case 61: + case 126: + case 151: + case 288: + case 339: + case 170: + case 21: + case 29: + case 32: + case 281: + $county = xss_clean($this->input->post('station_cnty', true)); + break; + default: + $county = ''; } // Create data array with field values @@ -179,11 +196,28 @@ class Stations extends CI_Model { $state = xss_clean($this->input->post('station_state', true)); } - // Check if DXCC is USA, Alaska or Hawaii. If not true, we clear the County field due to complex adif specs - if (($this->input->post('dxcc') == 291 || $this->input->post('dxcc') == 006 || $this->input->post('dxcc') == 110) && $this->input->post('station_cnty') !="") { - $county = xss_clean($this->input->post('station_cnty', true)); - } else { - $county = ''; + // Check if DXCC is USA, Alaska or Hawaii, RU, UR, and others with subareas. + // If not true, we clear the County field due to complex adif specs + switch ($this->input->post('dxcc')) { + case 6: + case 110: + case 291: + case 15: + case 54: + case 61: + case 126: + case 151: + case 288: + case 339: + case 170: + case 21: + case 29: + case 32: + case 281: + $county = xss_clean($this->input->post('station_cnty', true)); + break; + default: + $county = ''; } $data = array( diff --git a/application/views/station_profile/edit.php b/application/views/station_profile/edit.php index b3724c946..9fad6654b 100644 --- a/application/views/station_profile/edit.php +++ b/application/views/station_profile/edit.php @@ -138,7 +138,7 @@ if ($dxcc_list->result() > 0) {
- + station_cnty; } ?>">
diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index fc12b27f9..06fc8bde5 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -623,12 +623,34 @@ async function updateStateDropdown(dxcc_field, state_label, county_div, county_i }); } - if (selectedDxcc.val() == '291' || selectedDxcc.val() == '110' || selectedDxcc.val() == '6') { - $(county_div).show(); - } else { - $(county_div).hide(); - $(county_input).val(); - } + switch (selectedDxcc.val()) { + case '6': + case '110': + case '291': + $(county_div).find('.form-control').hide(); + $(county_div).find('.selectize-control').show(); + $(county_div).show(); + break; + case '15': + case '54': + case '61': + case '126': + case '151': + case '288': + case '339': + case '170': + case '21': + case '29': + case '32': + case '281': + $(county_div).find('.form-control').show(); + $(county_div).find('.selectize-control').hide(); + $(county_div).show(); + break; + default: + $(county_div).hide(); + $(county_input).val(); + } } function spawnQrbCalculator(locator1, locator2) {