End-users refresh after action (Button clicking), actions taken twice

As the title suggests, what would be the root cause of it and what would the solution be? Thanks a lot!

Hi Stephen Li,


Please explain your question clearly. A button has following methods:


1) Submit: The inputs are submitted. Uses the POST HTTP method. Means this method will refresh the page.


2) Ajax Submit: All the inputs you use in the Destination logic are asynchronously submitted (using Ajax techniques) while keeping the state of the screen. 


3) Navigate: The inputs are ignored. Uses the GET HTTP method. 


I think you must be using submit method on your button.


Regards,

Manthan Shah.

As Manthan said, you are probably using a submit method on your button. Perhaps you can change this to an Ajax Submit instead?

If not, please share your OML (either your current module or recreate the issue in a seperate module and share that). This way we can actually see what is happening.

Sorry for the delay of response. the problem happens mostly on the buttons that has "Submit" Method where it update the DB twice when the user tried to refresh the page after the button is clicked and the action is completed.

Hi Stephen Li,

Can you share the screenshots of action which is implemented on button click.


Regards,

Manthan Shah.

Manty wrote:

Hi Stephen Li,

Can you share the screenshots of action which is implemented on button click.


Regards,

Manthan Shah.

The action involves super lots of logic... Im afraid that it is hard to share it here.

I thought it would be a common problem faced by people using Outsystems, or this doesn't happen to other people? Refreshing the page will execute the previous action taken?

Hi Stephen,

It also happened to me but what I usually do is to select the cancel button instead of the ok button in the Popup dialogue which triggers when the page is refreshed. 


Please refer the below link:

https://stackoverflow.com/questions/6320113/how-to-prevent-form-resubmission-when-page-is-refreshed-f5-ctrlr


Hope it helps.


Regards,

Benjith Sam

Stephen Li wrote:

Manty wrote:

Hi Stephen Li,

Can you share the screenshots of action which is implemented on button click.


Regards,

Manthan Shah.

The action involves super lots of logic... Im afraid that it is hard to share it here.

I thought it would be a common problem faced by people using Outsystems, or this doesn't happen to other people? Refreshing the page will execute the previous action taken?

Hi Stephen,

Refreshing the page i.e. with F5 or Refresh option given in browser just calls the preparation of page it does not execute the previous action.

Regards,

Manthan Shah.


Benjith Sam wrote:

Hi Stephen,

It also happened to me but what I usually do is to select the cancel button instead of the ok button in the Popup dialogue which triggers when the page is refreshed. 


Please refer the below link:

https://stackoverflow.com/questions/6320113/how-to-prevent-form-resubmission-when-page-is-refreshed-f5-ctrlr


Hope it helps.


Regards,

Benjith Sam

Lucky to see someone got the solution. But I do not quite get what you mean with your solution. 

Hi Stephen,

When user refreshes a page, the browser execute all the last transaction again.

I had this problem once and I fixed it with this:

  • Create a button with a navigate to the page you want go after your main logic is finished. Put it in a hidden container.
  • At the end of you main logic, instead of navigate to that page, execute a RunJavaScript to click at your hidden button.

Let me know if it helped.

Fabrício Bonifácio wrote:

Hi Stephen,

When user refreshes a page, the browser execute all the last transaction again.

I had this problem once and I fixed it with this:

  • Create a button with a navigate to the page you want go after your main logic is finished. Put it in a hidden container.
  • At the end of you main logic, instead of navigate to that page, execute a RunJavaScript to click at your hidden button.

Let me know if it helped.

Sorry for the super late response. I have tried your attempt but it doesn't work.

And I just found out this ancient post that fix the problem. Just use Ajax submit instead of Submit and it fixes it like magic.

https://www.outsystems.com/forums/discussion/20415/confirm-form-resubmission-everytime-i-refresh/

Stephen Li wrote:

Fabrício Bonifácio wrote:

Hi Stephen,

When user refreshes a page, the browser execute all the last transaction again.

I had this problem once and I fixed it with this:

  • Create a button with a navigate to the page you want go after your main logic is finished. Put it in a hidden container.
  • At the end of you main logic, instead of navigate to that page, execute a RunJavaScript to click at your hidden button.

Let me know if it helped.

Sorry for the super late response. I have tried your attempt but it doesn't work.

And I just found out this ancient post that fix the problem. Just use Ajax submit instead of Submit and it fixes it like magic.

https://www.outsystems.com/forums/discussion/20415/confirm-form-resubmission-everytime-i-refresh/

Please see your question you asked and the answer for that was using submit method on the button which was answered in the first comment of the post and yes it Ajax Submit method will help you solve your problem.