PDA

View Full Version : Reset Back button


LLX
01-09-2006, 10:42 PM
i'm trying to find a way to reset the back button so when incrementing through my forms the users can't acidently go back to a previous page

rlemon
01-10-2006, 02:02 AM
You cannot clear the existing history but you can make sure a newly
selected page replaces the previous one preventing building up a
history. You do so by calling
location.replace('newPage.htm');
instead of assigning
location.href = 'newPage.htm';
The location.replace('url') call will replace the current page in the
history list with the new page thus preventing backing to the current
page.
You might also use that in a link with
<A HREF="javascript:location.replace('newPage.htm');">link</A>

The back button cannot be disabled besides using the above technique
for preventing backing or besides opening a new window without
toolbar/menubar.

LLX
01-10-2006, 05:13 PM
thanks, wanted to prevent users for doble processing a registration form, i dont even use pos to set varibles i use post for error checking then use session and redirect to move to the second form.

so if imy php is set up like this

<img src="spacer.gif" width=1 height=1 onLoad="javascript: location.href=\''.$SSL.$MainDir.$RegPage.'?LAID=1&AID=2&CCID='.$_GET['CCID'].'&SETID='.$_GET['SETID'].'&SelectID='.$_GET['SelectID'].'\'">

i shoud change it to what to it redirects and replaces?

mark87
01-10-2006, 05:48 PM
thanks, wanted to prevent users for doble processing a registration form

You could also disable the submit button once it's been clicked.

rlemon
01-10-2006, 06:08 PM
thanks, wanted to prevent users for doble processing a registration form, i dont even use pos to set varibles i use post for error checking then use session and redirect to move to the second form.

so if imy php is set up like this

<img src="spacer.gif" width=1 height=1 onLoad="javascript: location.href=\''.$SSL.$MainDir.$RegPage.'?LAID=1&AID=2&CCID='.$_GET['CCID'].'&SETID='.$_GET['SETID'].'&SelectID='.$_GET['SelectID'].'\'">

i shoud change it to what to it redirects and replaces?


use

<img src="spacer.gif" width=1 height=1 onLoad="javascript: location.replace=\''.$SSL.$MainDir.$RegPage.'?LAID=1&AID=2&CCID='.$_GET['CCID'].'&SETID='.$_GET['SETID'].'&SelectID='.$_GET['SelectID'].'\'">

LLX
01-10-2006, 06:57 PM
and that will redirect as well as replace?

rlemon
01-10-2006, 07:41 PM
that will replace the current page with the page specified in the browser window as well as history.

so to answer your question, yes.

LLX
01-11-2006, 07:28 PM
that will replace the current page with the page specified in the browser window as well as history.

so to answer your question, yes.

i tried it but it didnt do anything, as popos to the redirect thati normal get the page just sits there

echo '<img src="spacer.gif" width=1 height=1 onLoad="javascript: location.replace=\''.$SSL.$MainDir.$StudentPage.'?LAID=1&AID=50&CCID='.$_GET['CCID'].'\'">';

heres a snip of the relevent code when its not 'replace'

if (trim($_GET['CCID']) == '' AND trim($_POST['CCID']) != ''){
$_GET['CCID'] = $_POST['CCID'];
Echo 'If you are not redirected in a moment click <a href="'.$SSL.$MainDir.$StudentPage.'?LAID=1&AID=50&CCID='.$_GET['CCID'].'">here</a>';
echo '<img src="spacer.gif" width=1 height=1 onLoad="javascript: location.href=\''.$SSL.$MainDir.$StudentPage.'?LAID=1&AID=50&CCID='.$_GET['CCID'].'\'">';
};

rlemon
01-11-2006, 07:34 PM
http://docs.sun.com/source/816-6408-10/location.htm

also, you may want to check out this link

http://www.siteexperts.com/tips/functions/ts14/page1.asp