diff --git a/application/models/Stations.php b/application/models/Stations.php index 0639c743..7f35e0cf 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -97,6 +97,12 @@ class Stations extends CI_Model { } function edit() { + + if ($this->input->post('dxcc') == 1 && $this->input->post('station_ca_state') !="") { + $state = $this->input->post('station_ca_state'); + } else { + $state = $this->input->post('station_state'); + } $data = array( 'station_profile_name' => xss_clean($this->input->post('station_profile_name', true)), 'station_gridsquare' => xss_clean($this->input->post('gridsquare', true)), @@ -113,7 +119,7 @@ class Stations extends CI_Model { 'station_cnty' => xss_clean($this->input->post('station_cnty', true)), 'station_cq' => xss_clean($this->input->post('station_cq', true)), 'station_itu' => xss_clean($this->input->post('station_itu', true)), - 'state' => xss_clean($this->input->post('station_state', true)), + 'state' => $state, 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)), 'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)), diff --git a/application/views/station_profile/edit.php b/application/views/station_profile/edit.php index 67952c68..f2809222 100644 --- a/application/views/station_profile/edit.php +++ b/application/views/station_profile/edit.php @@ -87,7 +87,7 @@ -
+
+ Station state. Applies to certain countries only. Leave blank if not applicable. +
+ + +
+ + Station state. Applies to certain countries only. Leave blank if not applicable. -
+
diff --git a/assets/js/sections/station_locations.js b/assets/js/sections/station_locations.js index b1798657..08a8eef4 100644 --- a/assets/js/sections/station_locations.js +++ b/assets/js/sections/station_locations.js @@ -1,5 +1,30 @@ $(document).ready( function () { + + // Use Jquery to hide div ca_state + $('#station_locations_table').DataTable({ "stateSave": true }); + + $("#canada_state").hide(); + + var selectedDXCCID = $('#dxcc_select').find(":selected").val(); + + console.log(selectedDXCCID); + + if(selectedDXCCID == '1'){ + $("#canada_state").show(); + $("#us_state").hide(); + } + + $('#dxcc_select').change(function(){ + if($(this).val() == '1'){ // or this.value == 'volvo' + console.log("CANADA!"); + $("#canada_state").show(); + $("#us_state").hide(); + } else { + $("#canada_state").hide(); + $("#us_state").show(); + } + }); } );