Backbone Forms: pass event between different subviews

82 Views Asked by At

BRIEF:

Backbone Forms framework achieved that subviews are totally unbind and don't know about each other at all. So the question appears - how to pass the event between different subviews?

IN OTHER WORDS:

Suppose I have parent form object which extends Backbone.Form and contains a lot of fields. Have can I pass event from this parent for specific field (subview) of the form?

1

There are 1 best solutions below

0
evilcelery On

You can communicate directly from form to field by doing:

var form = new Backbone.Form({ schema: schema });

var field = form.getField('firstName');

Here's another example for communicating between two different fields using events. In this case, changing the options in the city based on the value selected in the country .

http://jsfiddle.net/evilcelery/c5QHr/