Avoid double posting example
When you access the web site using input for, you sometimes push back button after submit, or push the button again before the web page changes. Then the request to process the form data twice. In this page, I'll show you how to avoid the double post by using example.
In order to access this example, please access the url below or "Avoid double posting samples" link from the toppage.
Then the page below will appear.
In this page, submit a name, and push back button in the browser. And resubmit the form by pushing "Submit yout name".
At the first access, the operation for the form data is executed, but next time, the operation is ignored. The detai is in the implementataion.
The source code of this example is in "ALINOUS_HOME/samples/avoidrepost/" folder.
The implementation of "index.alns" in this folder is below.
In this sample, it checks if the operation from the inpurt from has been done or not by calling "AccessToken.check()". The implementation of "AccessToken.check()" is below.
This function checks if the access token is already in the database table or not. The access token is generated automatically by Alinous-Core.
The hidden parameter ACCESS_TOKEN is automatically generated, and this is unique for access in the same session. So the primary key of double_button_lock is session_id and access_token.