Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BACK Button

Status
Not open for further replies.

Albert3162

Programmer
Jul 13, 2001
18
0
0
US
Hello,

Do anybody know how to disable the BACK Button in the browser?
 
Albert3162, its not possible. Once the user has their browser window open you do not have any rights to manipulate it. Which is the way it should be.

But there are alternatives that can "fool" the browser, but these alternatives may not apply to all browsers and their versions. One alternative is to use DHTML, or JS that restricts the user from clicking the 'Back' button. Another is opening the site in a new window that strips the toolbar making it impossible for the user to back-track (but then again the user can simply right-click and go back a page that way)

Take a look into these alternative solutions and see if any of them work for you. One place to find scripts is and search that site.

[sub]
____________________________________
Just Imagine.
[sub]
 
GUJUm0deL,

Yes I know it's imposible,
When user hit this button, happend resubmit and duplicates row
 
Albert3162, so your concern is you don't want the users hitting the back button to re-submit the form again, right??

If so, try to cancel the session after the form has been submitted. Try running a query that matches the dB with the values in the form fields, and if they match delete the session so if the user does hit the back button they get a blank form.

I'm sure that is possible. Try asking either Ecobb, r937, their the CF experts around here, :)

[sub]
____________________________________
Just Imagine.
[sub]
 
or you could do it the easy way and just check to see if all the form fields are equal to all the database fields if they are just don't let the insert run. if all the fields don't match run the insert.

thereptilian120x120.gif
 
another question I was in a hurry to answer... let me explain.

when the person submits the form first check the database for existing entries.
For example:

<cfquery name = "qCheckDB">
SELECT count(id) as numberOfRecords
FROM tableName
WHERE firstName = '#form.firstName#'
AND lastName = '#form.LastName#'
AND Continue this for each field
</cfquery>

<cfif qCheckDB.numberOfRecords eq 0>
Process your insert query here
<cfelse>
<!--- output to the user an error message --->
This information has already been saved. Thank you.
</cfif>

thereptilian120x120.gif
 
I think more simpler way is to submit your form to another file and after finish processing data then take user to other file using cflocation. I usually do that. No need to worry about user refresh or press back button :)
 
Since we all have an opinion, how about expering the page.

I now there are some metta tags you can use to expire the page using date/time stamps. Usually, you would use now() which means that page expires as it is loaded. This in turns, means that once you submit, clicking on <BACK> buttom will give a "This page has expired message ..."

Regards;


Jose Lerebours


KNOWLEDGE: Something you can give away endlessly and gain more of it in the process! - Jose Lerebours
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top