How to prevent duplicate page submission?


    Apex 18.2.



    I have a page with a form and an interactive grid. Working as master-detail regions. If user hits any submit button i.e CREATE, SAVE or else more than one time by mistake it causes the records to get submitted more than once. A problem that was discussed before with some workarounds.


    One of the suggested solutions was to disable the submit buttons. Which leaves the problem of how to re-enable it when a validation fails. And it's hard to disable all submit buttons in all pages one has already created.


    Another way which I thought it was going to be a good one(if worked!) but did not for me.


    A third one which might be one of the best solutions because it's a native one is to create a "Submit Page" dynamic action with the "Show Processing" attribute = yes. But the problem is still about applying it to all submit buttons in all pages and sending the request name(the clicked button name) and the worst is that it makes submitting the page slower.



    P.S. using the page attribute "" does not help when a validation fails too. And I can not use "Reload on submit" attribute either because I have an IG in the page plus that the processes that fire when rendering the page will fire.


    I'd appreciate any kind of help about the best way to handle this problem.