Closed Bug 188544 Opened 22 years ago Closed 22 years ago

A BUTTON tag that calls a javascript function via the onClick event also submits the form

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 97829

People

(Reporter: jeremy, Assigned: rogerl)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212

<BUTTON onClick="addrow()">Add Row</BUTTON> will actually submit the form on the
webpage, even though there's nothing in the javascript function that tells it to
do so. The addrow function is suppose to simply move information that's in a
text input box into a select input box. This works as expected in IE, but not in
any version of Mozilla that I've tried (starting with 1.0.1 up through 1.3a).


Reproducible: Always

Steps to Reproduce:
1. Click the AddRow button

Actual Results:  
The form submits, even though it's not suppose to.

Expected Results:  
Run the javascript and NOT submit the form on the page.
Where is a bug? Look here: http://www.w3.org/TR/html401/interact/forms.html#h-17.5

type = submit|button|reset [CI]
    This attribute declares the type of the button. Possible values:
        * submit: Creates a submit button. This is the default value.

So if you use button without specific type it should do a submit. IE is broken
in this case.
This is a bug in IE.  A <button> with no type set is a submit button.

*** This bug has been marked as a duplicate of 97829 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Verified Duplicate -

Note this is not a JavaScript Engine issue. JavaScript Engine deals
with the abstract JavaScript programming language. Specifically, the
low-level objects such as String(), Number(), and Date(). The JS Engine
does not contain browser or DOM objects like document, forms, etc.

The best component for this would have been Form Submission 
(as in bug 97829).

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: