Yes… some of the pages have this code leakage. So same record will be inserted.
Now try to refresh the page n numbers of times…..database will contain n+1 number of same records.
This is a good validation for Test engineers but still a pain area for customers right ? Let us see how we can solve this case.
The solve can be of two ways..
1. Scripted validation in front end
2. Validation in Back end.
The algo will be
Save the form
Clear the form
Now again more customization can be implemented How??
We will be checking the blank value of any text box or mandate field and will throw error message…Normal validation error message only .
So if we press the refresh button once again it will try to enter null value and our validation logic will stop it from entering null value.
A smart solution can be to navigate to a next page after saving the data.
This is like ..on saving the data a page came saying that data have been successfully saved . Now you can disable the back button.
2. Checking the back end will also have several techniques…
1. In presence of a unique key or a unique filed…Say you have email id or might be an employee id inside the form. What you can do you can check the database first if it is having the same field present then the second entry is a duplicate one.That means we will not save this.
2. where there is no unique id present you can create a temp file with the coloumn of ipaddress and time.
Now while saving any record just check when the last saved happen and what was the ip. If the same request is coming from a same ip within 10 secs(The business team will be saying the time) do not save.