Disable BACK Button After Submitting a Form

SassyAmatol
SassyAmatol used Ask the Experts™
on
Hello all,

Is there a way I can disable the BACK button after I submit the form?  I have tried the meta tag to set the expiry date or set the no cache in it, but they didn't work.  Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You'll never be able to disable it entirely.
There are a few ways to avoid the back-button from jumping to the document in editmode (using javascript submit and location.replace) and perhaps opening a new window while closing the old (current) one could be of help.
Seeing you've tried setting the expiration, I don't think that's your ultimate wish... (see http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20178870.html)

Commented:
Interesting... CRAK I need to do this too... I have javascript to prevent users from multiple-clicking on the submit button (to avoid duplication) but the worms(users) hit the back button and then press the submit button AGAIN creating the dreaded duplicates!
The easiest way out is to launch the document in a pop-up window: close it on submit and its history is gone as well!

Another option is to handle submit in javascript and replace the current url.

1st I created a "submit" action (hyperlink) on the form. In javascript:
saveMe();

On the form (pass thru HTML, not in JS header, so I can add some computed text in it as well) I added following code:
<script language="javascript">
function saveMe()
{
window.document.forms[0].submit();
location.replace("/<Computed value>")
}
</script>

The computed value holds following code:
@ReplaceSubstring(@Subset(@DbName; -1); "\\"; "/") + "/DefaultView?OpenView"

(Please fill out a correct viewname)

Now this may cause some trouble if you have a "refresh on keyword change" on the form....
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Commented:
Cool... not sure I can do that but thanks for the 'free' tip!
Huh...?
Which free tip?
;-)

Commented:
I'm not paying for this question, just spying and mooching.
Glad I didn't reveil my "refresh on keyword change"-safe solution!

Commented:
Hmmm... no, not biting...
<GRIN>
Nope... I'm not!
<LOL>

Author

Commented:
Thanks CRAK for your suggestions.

I can't use the pop up window method because we are not allowed the use pop up windows.  I tried the location.replace method, it only worked if I added alert("message") between the submit() and location.replace, otherwise the form wouldn't save at all.  Do you have any clue?

Thanks
Weird... it works here... on localhost, but I've seen the problem before. Seen it work on a server before too (more or less literally the same!)

Author

Commented:
I have 2 agents in the webquerysave, I wonder if they're the reason.
Could be.....
Do they contain any print-statements?
Unless it's miles of code, why don't you paste it here so I can take a look?
Or perhaps you could set up a simple view + create button and a nearly emply form (without WebQuerySave agents) and see if it works.
Try the following jscript code on the Onload event of the form:

if(history.forward() != null) {
self.location.reload()
}

Hope it helps

C.A.

Author

Commented:
dominofan:

thanks for your suggestion, I already used it but some of the screen I have the cancel button so I can't use this function.

CRAK:
the two agents I have in that form: they don't have any print statement.  Both of them are using formula.  One is for writing the value back to the parent's, and another one is just some sendmail agent.
Have you tried this one....?
http://www.experts-exchange.com/Applications/Email/Lotus_Notes/Q_20413278.html
Check out my comment of 12/06/2002 05:52AM PST (MSIE5.5+ only!)

I'll see if I can find out why the option above is not working.

You mention 2 agents: Both "WebQuery"-agents occupied? Just in case... please paste the code?!

Commented:
CRAK, I'm going to be posting a question relating to this so please be on the lookout... just want to be clear on how this solution will work in my case.... be on the lookout for points!
Zvonko זְאֵבSystems architect
Top Expert 2006

Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: CRAK {http:#7576970}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Zvonko
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial