Hi,
I'm trying out Backbone.Form and like it so far.
I'd like to be able to have some class/function that AJAX updates a form but that isn't tied to a specific model.
No problem generating the actual inputs obviously, however I have an issue with setting the '.on' events and wondered if anyone had succeeded.
I'm trying this:
$.each( Object.keys(model.schema), function() {
key = this;
event = 'change:' + this;
form.model.on(
event, function(model, name) {
form.setValue({ this: name });
}, this);
});
But the inputs don't get updated when the AJAX returns, whereas this works:
form.model.on({
'change:field1': function(model, name) {
form.setValue({ field1: name });
},
'change:field2': function(model, name) {
form.setValue({ field2: name });
},
'change:field3': function(model, name) {
form.setValue({ field3: name });
}
});
Can anyone help?
Thanks
Mini