I recently came across jsrender/jsviews. In my first attempt I implemented a form using two way data linking/binding. This works but it immediately changes the model data as soon as the user types something into the input field.
The pattern I would like to implement is to update the model data on form submit allowing the user to easily cancel any edits they make.
Right now I've modified my form template to use one way binding and then I simply use jquery and pull the values out of the DOM and update the model data using $.observable(..).setProperty(...) when the user submits the form.
It works but it's terribly ugly. I assume there has to be a cleaner way that doesn't involve directly querying the DOM for the current values of the form elements.
Is there a clean way to trigger a model data update in an onsubmit handler in jsviews? Or what is the preferred way of implementing this usage pattern?
Basically I'm looking to achieve the same thing as is mentioned in this AngularJS question: Is there a pattern for dealing with "Cancel" in AngularJS modal dialogs? (i.e. something equivalent to ng-model-options="{ updateOn: 'submit' }" )