From 539705dbdff732629eff8916906e3f88ec5abd5c Mon Sep 17 00:00:00 2001 From: ebuster Date: Sat, 7 Mar 2015 23:36:25 +0300 Subject: [PATCH] Respect radio-button value in form triggers When I tried to use form triggers for radio button I found that this is impossible: field1: type: radio options: val1: ... val2: ... field1: type: ... trigger: action: hide field: type condition: value[val2] Propsed fix allows conditions like that. * and of couse - we need rebuild october-min.js --- modules/backend/assets/js/october.triggerapi.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/backend/assets/js/october.triggerapi.js b/modules/backend/assets/js/october.triggerapi.js index 7ae3fedaa..c0be46ff8 100644 --- a/modules/backend/assets/js/october.triggerapi.js +++ b/modules/backend/assets/js/october.triggerapi.js @@ -78,7 +78,12 @@ this.updateTarget($(this.options.trigger + ':checked', this.triggerParent).length > 0) } else if (this.triggerCondition == 'value') { - this.updateTarget($(this.options.trigger, this.triggerParent).val() == this.triggerConditionValue) + 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) + } } } @@ -146,4 +151,4 @@ $('[data-trigger]').triggerOn() }) -}(window.jQuery); \ No newline at end of file +}(window.jQuery);