When using the Master Detail page template, I am unsure of the best practices with regards to editing a record. Taking the out of the box template, there is a list with editable details on the same page. The issue I am finding is that when a user changes a record, it updates the record in memory as soon as the change is made to the field. If a user then selects another record, or something else in the menu, the change stays in memory but is not committed and therefore validations are not enforced. The list is updated to reflect the change however, since it is updated in memory.
This behavior is misleading as a user might think a change has been made, but it is not actually committed to the database until a save button is pressed or equivalent to commit the change.
I have seen some examples where the record is displayed as output text in a master-detail, and there is an edit button to display a dialog to edit the record with a proper save button.
What is the best approach to implement this functionality? I would prefer to allow the user the edit the record on the same page as the list, but require a save button to be pressed for validations and commit. If something else is selected, I would expect a rollback to happen if it hasnt been saved.