this is my code from the docs from which i want to learn from. in my opinion it would be cool to hide the second select and show it up, when the change event was fired. i tried some function injections without good results. can anyone give 2 cents to this issue?
(function($) {
var cities = {
'UK': ['London', 'Manchester', 'Brighton', 'Bristol'],
'USA': ['Washington DC', 'Los Angeles', 'Austin', 'New York']
};
//The form
var form1 = new Backbone.Form({
schema: {
country: { type: 'Select', options: ['UK', 'USA'] },
city: { type: 'Select', options: cities.UK },
message: { type: 'Text'}
}
}).render();
form1.on('country:change', function(form1, countryEditor) {
var country = countryEditor.getValue(),
newOptions = cities[country];
form1.fields.city.editor.setOptions(newOptions);
});
//Add it to the page
$('body').append(form1.el);
})(jQuery);