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
This commit is contained in:
ebuster 2015-03-07 23:36:25 +03:00
parent 02db7cd00a
commit 539705dbdf

View File

@ -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);
}(window.jQuery);