I have bound the text inputs in a form to a Backbone Model using backbone-stickit bindings
:
bindings: {
'#txtRemarks': 'remarks',
'#txtFromAccountNumber': 'account_no',
'#fileChooser':'fileChooser'
}
When I reset the form, the values in the text inputs are getting cleared, but the values are still present in the model attributes.
Stickit default handler for input elements is (source):
It listens to
'propertychange', 'input', 'change'
and a form reset doesn't trigger these events.You will need to manually listen to the
reset
event of the form and update the model manually.Or another trick when dealing with forms is to keep a copy of the model in its initial state, before doing any change. Then you can use the copy to reset the attributes or to check if there were changes.