Here we extend the basic form example to include common features such as reverting, dirty state detection, and preventing invalid form submission.
Source
Demo
Things to notice
- Cancel & save buttons are only enabled if the form is dirty — there is something to cancel or save.
- Save button is only enabled if there are no validation errors on the form.
- Cancel reverts the form changes back to original state.
- Save updates the internal model of the form.
- Debug view shows the two models. One presented to the user form and the other being the pristine copy master.