Post/Redirect/Get Pattern (Prevent form resubmission on refresh of a page -> AKA F5)

Post/Redirect/Get Pattern (Prevent form resubmission on refresh of a page -> AKA F5)

  

Hello,

 

On OutSystems after an action is submitted using the method submit (HTTP POST request), if the user attempts to refresh the screen it will cause the contents of the original HTTP POST request to be resubmitted, possibly causing undesired results, such as a duplication of records or upload of files.


Post/Redirect/Get (PRG) is a web development design pattern that prevents some duplicate form submissions:



To implement such pattern in the platform you can use the actions exposed by the reference HTTPRequestHandler in the POST/Submit server action (if the destination of the POST is a screen use the preparation).

  • SetStatusCode - 303
  • GetEntryURL - Build the destination URL for the GET step
  • AddHeader
    • Name: location
    • Value: Destination URL


Thanks,

José Fábio Vieira


Are you submitting this action on button click?

If yes, check what is the method you are using to submit the page.

If you want to avoid resubmission, it should be set to Ajax Submit.

I'm referring and suggesting this pattern for whenever you need to apply the method submit on a button/link.

This can be used when you upload files on your forms or whenever you have a business requirement which requires Submit/POST requests

This is the Dialog windows usually shows up, I've tried to update the original but it seems it doesn't allow me