JavaScript-based "Submit Form" link/button does not work

VERIFIED INVALID

Status

()

Core
DOM: Core & HTML
VERIFIED INVALID
14 years ago
14 years ago

People

(Reporter: Bruno Oliveira, Unassigned)

Tracking

({testcase})

Trunk
x86
All
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030827
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030827

A link whose href is "javascript:foo.submit()" does not submit the "foo" form
when clicked. The form is declared with attributes name="foo" id="foo". The JS
console says "foo is not defined". I observed the behavior both in the Unix and
Win32 builds; I also tried to compile from source and still verified the same
behavior. Many websites use this type of construct, so in my opinion it is worth
fixing. Rather than give you a list of the websites I found this in, I've looked
at the sources for the sites and isolated the problem and built a simple webpage
that induces exhibition of the bug:

http://www.linux.ime.usp.br/~btco/mozillabug/index.html


Reproducible: Always

Steps to Reproduce:
1. go to http://www.linux.ime.usp.br/~btco/mozillabug/index.html
2. click the "Submit" link
3. notice that nothing happens! It should submit the form. In MSIE it does.

Actual Results:  
Nothing happens in the browser window. JS complains that "foo is not defined".

Expected Results:  
Mozilla should have submitted the form as though a normal "Submit" button had
been clicked. This is the behavior of MSIE, and many (good and well-coded) sites
expect it to work and provide no other means to submit the form.


Just in case the test page I have put up is down, I will add an attachment to
this bug report containing the test files. They are exactly the same as what is
posted in the test page (www.linux.ime.usp.br/~btco/mozillabug/index.html), so
don't bother looking at the attachment unless the online page is down.
(Reporter)

Comment 1

14 years ago
Created attachment 131112 [details]
test pages (just in case the test site I put up is down)

Contains two test pages: index.html and nextpage.html. The index.html page is
the one you should try to access. Please use this only if the online test pages

are down. The URL for the online test page I put up is:

http://www.linux.ime.usp.br/~btco/mozillabug/index.html

Comment 2

14 years ago
Tools > Web Development > JavaScript Console:

Error: theForm is not defined
Source File: javascript:theForm.submit()
Line: 1


It will work if you change it to "javascript:document.theForm.submit()"

-> INVALID
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Keywords: testcase
Resolution: --- → INVALID
verified invalid
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.