I've come up with a way that I can do form submission after a specified number of seconds that is reliable enough for our purposes in Firefox. Unfortunately, the technique fails in all other browsers that I've tested and I can't seem to figure out why.
Refresh Code (the timer checks/values are all set by JSP - checking the page source before the form submission shows the same code in all browsers, so I think I can rule out my JSP as the culprit here):
HTML (if timing is needed):
HTML form definition:
Basically, I set a timer variable that determines whether a meta refresh tag should be placed, and what its value should be. This is important because I need the timer to use externally specified times. Since I know that the page is going to refresh (and hence, trigger the onunload event), I warn users not to use back/forward/refresh commands, and have the onunload event trigger a form submission. For some reason, in Safari, Chrome, and IE, the code on the submitted form's target page never executes, even though the alert in the submitForm() function is triggered.
Does anyone have any idea what might be going on here? My method seems pretty simple, and I'm having a hard time seeing what the issue might be.
Thanks for any help.
Bear Bibeault wrote:Why not just use window.setTimeout()?
Well, I can't figure out how to dynamically set the number of miliseconds while doing that.
Well, this is basically the JSP code I have now:
Bear Bibeault wrote:Eric's point is if you can use the scriptlet expression in one place in the JSP, why can't you use it elsewhere?
(Hint: the answer is there's no reason).