]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/components/toggle-switch.js
Added crude example of captcha usage
[bookstack] / resources / assets / js / components / toggle-switch.js
index 3dd1ce85ccb4bd3d94983e34605a2651d3d47be0..b9b96afc5d07728d992e9cd49eab9e29a6df1f2a 100644 (file)
@@ -11,6 +11,11 @@ class ToggleSwitch {
 
     stateChange() {
         this.input.value = (this.checkbox.checked ? 'true' : 'false');
+
+        // Dispatch change event from hidden input so they can be listened to
+        // like a normal checkbox.
+        const changeEvent = new Event('change');
+        this.input.dispatchEvent(changeEvent);
     }
 
 }