I'm working with some software that uses an HTML form for a user interface to change some configuration information. The back end is a database (loosely speaking).
The front end has a hierarchy of values which can be changed in
When's the right time to push user-initiated changes into the database? There doesn't seem to be a great answer here:
when the content of each field changes -- if I go to type the value
1.13e5into a field, then it will see intermediate values
1.13e5written. Those intermediate values are not what the user intends.
on loss of focus (typically, user starts working on another part of the form) -- this shields the database from intermediate values during typing, but loss of focus can occur when switching to other applications. Also, it seems weird to use a change of focus to cause a mutation in the database; changing focus seems like it should be a read-only operation where writing values isn't expected.
explicit push for each field (editing a field brings up a checkbox, and the value isn't written until the checkbox is clicked) -- this makes it explicit to change values, but somewhat tedious
explicit push for entire form (user has to click an "OK" or "Submit" button) -- this makes it explicit, but if there are a lot of values, the user may forget that they've made edits, and could accidentally close the window and lose changes.
Are there examples in the real world where someone has considered these sorts of options and has made a well-reasoned decision? I want to learn from someone else's work.
The admin interface for Discourse uses the "explicit push for each field" approach, along with a reset-to-default element for items that have been changed. This seems like it might be a good idea to mimic but I'm not 100% sure.