I'm trying to find the best approach to customising the edit post screen for a custom post type.
I want to add a button which, when clicked will trigger code which looks up an external (not WP) database, gets some data, and then updates various fields - both core WP fields and custom meta fields. Ideally, the updates should update fields in the editor, but not commit anything to the WP database until the user then saves the edits (with the normal 'update' button).
So far, I have tried adding a submit button in the metabox, and then hooking into 'wp_insert_post_data'. That works, but I get a browser "The changes you made will be lost if you navigate away from this page" message if any fields have been edited which I don't want.
As for updating the data, I am updating $post by hooking into 'dbx_post_advanced', and adding my own filters to hook into my custom meta fields, which updates what goes into the fields without updating the DB. Again, that works, but 'dbx_post_advanced' feels a bit hackish as it is buried deep in edit-form-advanced.php and there's no documentation I could find as to what it is meant to be used for.
Is there a better way to achieve this, or at least some way to avoid the browser complaining that I'm moving away from a page where I have made edits?