Link to home
Start Free TrialLog in
Avatar of SassyAmatol
SassyAmatol

asked on

Disable BACK Button After Submitting a Form

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!
Avatar of CRAK
CRAK
Flag of Netherlands image

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 https://www.experts-exchange.com/questions/20178870/History.html)
Avatar of snocross
snocross

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....
Cool... not sure I can do that but thanks for the 'free' tip!
Huh...?
Which free tip?
;-)
I'm not paying for this question, just spying and mooching.
Glad I didn't reveil my "refresh on keyword change"-safe solution!
Hmmm... no, not biting...
<GRIN>
Nope... I'm not!
<LOL>
Avatar of SassyAmatol

ASKER

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!)
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of CRAK
CRAK
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!
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