bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

form submit() method does not work in setTimeout handler




HTML: Form Submission
14 years ago
13 years ago


(Reporter: cydergoth, Unassigned)


Windows XP

Firefox Tracking Flags

(Not tracked)



(1 attachment)



14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316

function doSubmit() { 
  alert("Submit done.");


This fails in mozilla, works in IE

Reproducible: Always
Steps to Reproduce:
1. setup a timer using setTimeout
2. in the timeout handler try to submit the form
3. watch nothing happen

Actual Results:  

Expected Results:  
submitted the form (works in IE)

Comment 1

14 years ago
could you please give an example URL were this feature is used, at a real website?
Imho this feature is a violation of my privacy, taking control of my computer.
If there were some vulnerability in JS at the same time, a website could fetch
some data via JS, insert it into a form, and sent it back.
I don´t think Mozilla should copy this "feature" of explorer.
Do you have popup blocking enabled?  If so, this operation would be blocked as a
popup (which it is).

Comment 3

14 years ago
I don't think this should be blocked as a popup. Using form.submit()
programatically is how a lot of advanced widgets work. The particular problem
with this example is that the submit() is inside a timeout handler. It works
outside of the timeout handler as expected.

Whilst I understand the commenta about control, form.submit() is part of the
client side javascript specification.


Comment 4

14 years ago
Does the form have a target?  If it doesn't, it shouldn't be blocked as a
pop-up.  If its target is a new window, this is a dup of bug 136195.

Comment 5

14 years ago
(In reply to comment #4)
> Does the form have a target?  If it doesn't, it shouldn't be blocked as a
> pop-up.  If its target is a new window, this is a dup of bug 136195.

Thanks for this. This form did not have a target. It was a normal form. If the
forms[0].submit() was executed outside the timeout handler, behaviour was
correct and normal, inside the timeout handler the submit does not work.

Created attachment 156321 [details]

This works fine here, using:
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a3) Gecko/20040812

Comment 7

13 years ago
Had the same now with firefox 1.0.2

In the code
<script type="text/javascript">
 	function AbGehts()
 	window.setTimeout("AbGehts()", 0);


I got the JS error that document.Sendungsstatus has no properties.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Last Resolved: 13 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.