Skip to content

Commit

Permalink
Fix input trigger on source field types with multiple selected values (
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcottrell authored and LukeTowers committed Sep 19, 2018
1 parent 9d126a0 commit 6f2ed02
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
18 changes: 13 additions & 5 deletions modules/system/assets/ui/js/input.trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
this.updateTarget(!$(this.options.trigger + ':checked', this.triggerParent).length)
}
else if (this.triggerCondition == 'value') {
var trigger, triggerValue = ''
var trigger, triggered = false

trigger = $(this.options.trigger, this.triggerParent)
.not('input[type=checkbox], input[type=radio], input[type=button], input[type=submit]')
Expand All @@ -67,11 +67,19 @@
.not(':not(input[type=checkbox]:checked, input[type=radio]:checked)')
}

if (!!trigger.length) {
triggerValue = trigger.val()
}
var self = this
trigger.each(function() {
var triggerValue = $(this).val();

$.each($.isArray(triggerValue) ? triggerValue : [triggerValue], function(key, val) {
triggered = $.inArray(val, self.triggerConditionValue) != -1
return !triggered
})

return !triggered
})

this.updateTarget($.inArray(triggerValue, this.triggerConditionValue) != -1)
this.updateTarget(triggered)
}
}

Expand Down
9 changes: 6 additions & 3 deletions modules/system/assets/ui/storm-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6f2ed02

Please sign in to comment.