diff --git a/modules/system/assets/ui/docs/input.hotkey.md b/modules/system/assets/ui/docs/input.hotkey.md
new file mode 100644
index 000000000..d8d435324
--- /dev/null
+++ b/modules/system/assets/ui/docs/input.hotkey.md
@@ -0,0 +1,15 @@
+# Input Hotkey API
+
+Scripts that manage user input events.
+
+# Example
+
+
+
+
+
+
diff --git a/modules/system/assets/ui/docs/input.md b/modules/system/assets/ui/docs/input.md
deleted file mode 100644
index 7484b5a92..000000000
--- a/modules/system/assets/ui/docs/input.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# Input
-
-Scripts that manage user input events.
-
-# Example
-
-
Example: input.hotkey
-
-
-
-
-
-
-
-
Example: input.preset
-
-
-
-
-
-
-
Example: input.trigger
-
-
-
-
-
-
-
Example: input.monitor
-
diff --git a/modules/system/assets/ui/docs/input.monitor.md b/modules/system/assets/ui/docs/input.monitor.md
new file mode 100644
index 000000000..a2c019b26
--- /dev/null
+++ b/modules/system/assets/ui/docs/input.monitor.md
@@ -0,0 +1,6 @@
+# Input Monitoring
+
+Scripts that manage user input events.
+
+# Example
+
diff --git a/modules/system/assets/ui/docs/input.preset.md b/modules/system/assets/ui/docs/input.preset.md
new file mode 100644
index 000000000..b5b8807ec
--- /dev/null
+++ b/modules/system/assets/ui/docs/input.preset.md
@@ -0,0 +1,11 @@
+# Input Preset API
+
+Scripts that manage user input events.
+
+# Example
+
+
+
\ No newline at end of file
diff --git a/modules/system/assets/ui/docs/input.trigger.md b/modules/system/assets/ui/docs/input.trigger.md
new file mode 100644
index 000000000..bf27e124b
--- /dev/null
+++ b/modules/system/assets/ui/docs/input.trigger.md
@@ -0,0 +1,50 @@
+# Input Trigger API
+
+The API allows to change elements' visibility or status (enabled/disabled) basing on other elements' statuses. Example: enable a button if any checkbox inside another element is checked.
+
+### Supported data attributes:
+
+- data-trigger-action, values: show, hide, enable, disable, empty
+- data-trigger: a CSS selector for elements that trigger the action (checkboxes)
+- data-trigger-condition, values:
+ - checked: determines the condition the elements specified in the data-trigger should satisfy in order the condition to be considered as "true".
+ - value[somevalue]: determines if the value of data-trigger equals the specified value (somevalue) the condition is considered "true".
+- data-trigger-closest-parent: optional, specifies a CSS selector for a closest common parent for the source and destination input elements.
+
+Example code:
+
+
+
+### Supported events:
+
+- oc.triggerOn.update - triggers the update. Trigger this event on the element the plugin is bound to to
+ force it to check the condition and update itself. This is useful when the page content is updated with AJAX.
+
+### JavaScript API:
+
+ $('#mybutton').triggerOn({
+ triggerCondition: 'checked',
+ trigger: '#cblist input[type=checkbox]',
+ triggerAction: 'enable'
+ })
+
+# Example
+
+
+
+
+
+
diff --git a/modules/system/assets/ui/js/input.trigger.js b/modules/system/assets/ui/js/input.trigger.js
index f9af7a5a9..e27d967f8 100644
--- a/modules/system/assets/ui/js/input.trigger.js
+++ b/modules/system/assets/ui/js/input.trigger.js
@@ -78,13 +78,10 @@
this.updateTarget($(this.options.trigger + ':checked', this.triggerParent).length > 0)
}
else if (this.triggerCondition == 'value') {
- var trigger = $(this.options.trigger + ':checked', this.triggerParent);
- if (trigger.length) {
- this.updateTarget(trigger.val() == this.triggerConditionValue)
- }
- else {
- this.updateTarget($(this.options.trigger, this.triggerParent).val() == this.triggerConditionValue)
- }
+ var trigger = $(this.options.trigger + ':checked', this.triggerParent),
+ needle = trigger.length ? trigger.val() : $(this.options.trigger, this.triggerParent).val()
+
+ this.updateTarget($.inArray(needle, this.triggerConditionValue) != -1)
}
}