How to save view fields into the models when, for instance, the form's save is clicked with Backbone.stickit

StackOverflow https://stackoverflow.com/questions/22684717

Question

I was using backbone.stickit so far for cases when the model should be updated immediately when the view's field was updated. But for several cases I found that it's more appropriate to update the model only when submit is pressed.

Stickit supports events so the events triggering override of the model can be defined. These events, however, are only input field specific.

Is it possible to trigger the override of the model for view events (like clicked:submit) ?

Thanks for advice.

Was it helpful?

Solution

I found a solution using custom event saveClicked triggered on input fields. In the bindings I set the field to stick to this custom event. For the form when save was clicked for every input field (also select, textarea,..) the saveClicked event is triggered.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top