Well, depending on the requirement details you may need to customize the UI code files. Be sure to document these changes well in the project documentation to prevent any further issues and data loss.
Or, I would create a an alternative form with the custom logic or, maybe use custom module with custom template.
Or, create the logic for the button as a custom form control and add it as a field to the page type.
I would recommend to re-consider the logic and need to avoid the customizations to the system files. Maybe using a custom module will be better or adding a custom tab to the UI. The ide is very similar to creating custom module interface, you will just add the UI element to the Content module.