Hi all,
I'm working with ASP (obviously) with an access database!
I have this page that allows the user to apply online for a course.
The action in the form tag calls a page that checks all required filelds were filled & only adds the users details if they were (or else an error page is displayed saying "Required field(s) name, address, etc.... weren't filled!")
Regular enough senario!
But my problem is that the user can use their back button to go back to the application page & hit submit again!
Then there is another record created for them in the database.
I could use code like the following at the top of my application page:
<%
' ### Make the page reload on using the back button! ### < START >
' This makes sure that the page is reloaded when the user uses the back button!
' Got from:
http://www.net-language.com/CodeExample.aspx?i=92'no cache - BROWSER
Response.Expires = 0
Response.Expiresabsolute = Now-1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","dim"
' no cache - PROXY
Response.CacheControl = "no-cache"
response.buffer = true
' ### Make the page reload on using the back button! ### < END >
%>
This would force a refresh (well in Internet Explorer anyway).
But in the event of the user not filling in all the required fields & a descriptve error message(s) been displayed to them, I would like the back button to be allowed because this then would prevent them from having to re-fill out the whole application again!
Also I don't want to disable the submit button on the application page or anything like that, because after one user has applied they might also want to apply for their friends!
I assume I have a few options:
1. Put in the code above to force a refresh & therefore the user HAS to re-fill the entire application each time!
2. Allow the back-button but have a check for a duplicate record in the database before I add in the new application.
3. Use the code above to force a refresh but store the previously selected & typed values in ASP variables, maybe sessions. And re-populate these when the application page is displayed!
Also while I'm on the subject of refreshing etc..
Does anyone have code that will force a refresh on both FireFox & Intrernet Explorer!
Can someone please tell me which option is best, or point me in the right direction!
Much much thanks!
Best,
Dcom.
Start Free Trial