diff --git a/smash/web/static/js/appointment.js b/smash/web/static/js/appointment.js
index 0be1d9e0186ebcf1a17232602ca0e2d1977f60e7..6cb810679a794340d952801965f5163ab064eb3b 100644
--- a/smash/web/static/js/appointment.js
+++ b/smash/web/static/js/appointment.js
@@ -146,17 +146,19 @@ function appointment_date_change_behaviour(datetime_picker, worker_select, minut
 
     $(worker_select).addClass(previousClass);
 
-    $(worker_select).on('focus', function () {
-        // Store the current value on focus and on change
-        previousClass = getSelectedClass();
-    }).change(function () {
+    function workerChanged() {
         // Do something with the previous value after the change
 
         $(worker_select).removeClass(previousClass);
         // Make sure the previous value is updated
         previousClass = getSelectedClass();
         $(worker_select).addClass(previousClass);
-    });
+    }
+
+    $(worker_select).on('focus', function () {
+        // Store the current value on focus and on change
+        previousClass = getSelectedClass();
+    }).change(workerChanged);
 
     function timeChange() {
         if ($(datetime_picker).val() != "") {
@@ -190,7 +192,7 @@ function appointment_date_change_behaviour(datetime_picker, worker_select, minut
                         option.className = "worker-option-no-match";
                     }
                 }
-                $(worker_select).trigger("change");
+                workerChanged();
             });
         }
     }
diff --git a/smash/web/static/js/smash.js b/smash/web/static/js/smash.js
index 7d27ccd062cf0b7a5568f767a996abfbeb39c5bf..2d37d9277595a8eac5d57f24d98993646be8d43e 100644
--- a/smash/web/static/js/smash.js
+++ b/smash/web/static/js/smash.js
@@ -9,6 +9,19 @@ $(document).ready(function () {
         $("." + $(this).attr("data-hide")).hide();
     });
 
+    var formDataChanged = false;
+
+    $(":input", this).change(function () {
+        formDataChanged = true;
+    });
+
+    $('.main-sidebar a').click(function () {
+        if (formDataChanged) {
+            return confirm("Data changed. Are you sure you want to leave?");
+        } else {
+            return true;
+        }
+    })
 });
 
 $.ajaxSetup({