]> wagnertech.de Git - mfinanz.git/blobdiff - js/kivi.js
kivi.js: Funktion zur Prüfung, ob mindestens eine Checkbox gecheckt ist
[mfinanz.git] / js / kivi.js
index 27077575d70fd12e2140d5545a3196598992fd99..daf360b23296ad224e9c1427b69f8322e62a83f7 100644 (file)
@@ -459,6 +459,21 @@ namespace("kivi", function(ns) {
     if (!found)
       console.log('No duplicate IDs found :)');
   };
+
+  // Verifies that at least one checkbox matching the
+  // "checkbox_selector" is actually checked. If not, an error message
+  // is shown, and false is returned. Otherwise (at least one of them
+  // is checked) nothing is shown and true returned.
+  //
+  // Can be used in checks when clicking buttons.
+  ns.check_if_entries_selected = function(checkbox_selector) {
+    if ($(checkbox_selector + ':checked').length > 0)
+      return true;
+
+    alert(kivi.t8('No entries have been selected.'));
+
+    return false;
+  };
 });
 
 kivi = namespace('kivi');