Conditional Logic

(This document is a work in progress.)


While there is no specific event for listening to a field being show or hidden, using native Backbone you can listen for a field model change and check which attribute was changed.

For example, listening on the fields channel for the change:model event, check if the fieldModel’s visible attribute has changed.

var myConditionalLogicController = Marionette.Object.extend({
initialize: function () {
this.listenTo('fields'), 'change:model', this.fieldModelChange );
fieldModelChange: function( fieldModel ) {
if ( fieldModel.changed.visible !== true) return;
// code to be run when a conditional is field is shown