this is the code from backbone-forms. for now, i would like to render a submit button to validate my textfield and stuff, which is documented, except how to get that submit button into the dom. feel free to downvote, anyways in my opnion this is hard to figure out for noobs
(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);