Copy link to clipboard
Copied
Hi Sir/Madam,
Does any one having this: "To display this webpage correctly, resubmit the data you entered earlier. By doing this, you will repeat any action this page previously performed." when click back or click on a button with code: history.back(); ? Strange, the same identical code works on our another coldfusion server ( both environments are Win2019, and Coldfusion 2016). I do not see any server error or client error.
Much appreciated for your help.
James
Copy link to clipboard
Copied
Does any one having this: "To display this webpage correctly, resubmit the data you entered earlier. By doing this, you will repeat any action this page previously performed."
By @Enchanted_vibrancy5464
The error is not actually a ColdFusion error. It is typically caused by improper handling of a combination of a POST request and a redirect/cflocation.
The best way to prevent the error is to use the Post/Redirect/Get pattern. The underlying idea is as follows.
After the user submits the form (via the Post method), redirect the user (using cflocation, for example) from the action-page to a new page that does not require resubmitting data. This avoids the scenario where the page is refreshed after form submission.
Sometimes, this issue is browser-specific and can be due to browser settings, such as aggressive caching. In such circumstances, the browser may cache the post data incorrectly. In that case, you might need to set caching headers, such as the following, to ensure proper behaviour after form submission:
<cfheader name="Cache-Control" value="no-cache, no-store, must-revalidate">
<cfheader name="Pragma" value="no-cache">
<cfheader name="Expires" value="0">
Copy link to clipboard
Copied
Thanks for the suggestion, but relocation to another page might not be what the user want. It turned out that after changing some "method: from "post" to "get", the history.back() works.
For exampe:
from: <form name="WIN" action="aform.cfm" method="post" target="sel_bottom">
to: <form name="WIN" action="aform.cfm" method="get" target="sel_bottom">
It seems the previous developer used wrong method, but what puzzles me is that the exact code works without any issue on the other Windows 2019 server where Coldfusion version is also Coldfusion11, but on the new server, I have to change method "post" to "get", in order to make "history.back()" work. Is that related to something on the Coldfusion settings? ( I noticed application.log on the new server does not log same error as it does on another server even though I set all settings identital as the other Coldfusion server on Admin page; it is another story, but I do not know if that means some settings might have impact on the coldfusion application).
Copy link to clipboard
Copied
That's all right. Changing the form's method from post to get is one of the recommendations of the Post/Redirect/Get pattern. I had assumed you had used a redireirect, as is often the case with this error.
@Enchanted_vibrancy5464 wrote:
... but what puzzles me is that the exact code works without any issue on the other Windows 2019 server where Coldfusion version is also Coldfusion11, but on the new server, I have to change method "post" to "get", in order to make "history.back()" work. Is that related to something on the Coldfusion settings? ( I noticed application.log on the new server does not log same error as it does on another server even though I set all settings identital as the other Coldfusion server on Admin page; it is another story, but I do not know if that means some settings might have impact on the coldfusion application).
It's unclear. Now you say the ColdFusion version is 11. However, in your original question you said, "the same identical code works on our another coldfusion server ( both environments are Win2019, and Coldfusion 2016)."
Copy link to clipboard
Copied
Sorry, My bad. They actully both are Adobe Coldfusion 11, on Windows server 2019.
I am really insterested in the reason why it works on the other Coldfusion server with the same code. Thanks!