Confirm Form Resubmission everytime I refresh

I have created Database table as read only on a separate module. 

Used accelerators to create the List and Detail pages.

Added a Save button that calls a Public Server Action from another module to save the record.

Whenever it gets back to my list page and I refresh the page I get a Confirm Form Resubmission alert, and if I click continue it saves the record I had previously saved again. 

Any ideas on why this might be happening?


Thanks

Solution

Is the button's method Submit? Try Ajax submit.

And how are you directing to the list page after calling the save action?

Solution

João Melo wrote:

Is the button's method Submit? Try Ajax submit.

And how are you directing to the list page after calling the save action?

That fixes it. I was just used to the accelerators that I did not notice that it set the Save as an ajax submit. 

For your second question I am redirecting by using a destination at the end of the Save screen action.


Thanks a lot for your help!


João Melo wrote:

Is the button's method Submit? Try Ajax submit.

And how are you directing to the list page after calling the save action?

Hello,


I tried to do it in my project but i have in the same Save Action (Create or Update Car and Create or Update Picture). When i use Ajax Submit Method the Picture of the car is never saved (must have submit when related to picture (binary)). It is a good practice after saving the Car and Picture direct the page to a External URL to solve this problem?


Regards,


Pedro Santos 


Hi Pedro, in this case I recommend you to either:

1. Use a component that allows you to upload files through Ajax (look for it on Forge)

2. Or create a pop-up to upload the file via Submit and keep your page action as Ajax submit

João Melo wrote:

Hi Pedro, in this case I recommend you to either:

1. Use a component that allows you to upload files through Ajax (look for it on Forge)

2. Or create a pop-up to upload the file via Submit and keep your page action as Ajax submit

Thank you for the quick response.


Pedro Santos


In some situations you can't change the method to ajax and you will actually require a submit button (for example uploading files). In such situations, any browser after the form is submitted if you refresh it the behaviour is to send the data again


Then what you should do is the Post/Redirect/Get Pattern, of course, there are different approaches like opening a popup to upload files (needs a cache) or using a javascript solution to solve the issue (more complicated and also requires a cache but a component already exists: File Upload) it will actually depend on your UX and how you want to approach the solution for your problem