Closed Bug 46868 Opened 24 years ago Closed 24 years ago

form.onsubmit not visible as a function from javascript

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

VERIFIED DUPLICATE of bug 49120

People

(Reporter: dprophete, Assigned: brendan)

Details

(Keywords: helpwanted, relnote, testcase, Whiteboard: [nsbeta3+])

Attachments

(1 file)

As for bug #35463, it seems like the onsubmit method of a form is not visible
from JS. In bug #35463, the onchange method of a textfield was not visible
first, and became visible after something was typed into the textfield. Same
thing here (except that there is no textfield): onsubmit() is not visible at
first, but if a submit button is pressed first the onsubmit method becomes visible.

here is an example that will help clarify:

<html>
<body>

<form method=get name=myform onSubmit='alert("onsubmit"); return false'>
<input type=submit value='regular submit button'>
<a href='#' onClick='document.myform.onsubmit()'>link that calls onsubmit()</a>
</form>

</body>
</html>


what happens here is that we have a submit button (which when pressed, will call
myform.onsubmit()), and a link that is supposed to call onsubmit() when clicked.
When onsubmit() is executed, it just pop up a simple alert box.

if I press the link first, mozilla throws a JS JavaScript error:
 line 0: this.form.aField.onchange is not a function

but if I press the submit button *first*, and *then* the link, it works fine (as
I said, this is very similar to bug #35463)


oh, and btw, I tested this on M16 and on the nightly build (7/27/00) on Mandrake
(and I got the same result...)

-Didier
Confirmed Linux 2000080308.
Status: UNCONFIRMED → NEW
Ever confirmed: true
adding a testcase based on the reporter's example.
Keywords: testcase
Attached file testcase
This bug has been marked "future" because the original netscape engineer
working on this is over-burdened. If you feel this is an error, that you or
another known resource will be working on this bug,or if it blocks your work
in some way -- please attach your concern to the bug for reconsideration.
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
Target Milestone: --- → Future
Johnney, it could be important, coz not everybody uses submit buttons to submit 
information, and want to call some functions onsubmit.
Nominating nsbeta3. 
Keywords: nsbeta3
Loss of backward compatibility with DOM0 is indeed a serious issue. Marking 
helpwanted. Vidur, Tom, Brendan -- any chance you could lend a hand with this 
one?
Keywords: helpwanted
Unfortunately, we don't have the cycles to deal with this.  Marking nsbeta3-.
Keywords: relnote
Whiteboard: [nsbeta3-][egk]
   Lisa:  [reading the classifieds]  Hey, here's a good job, Dad!
          Oh, wait, you have to know how to operate an ultrasonic
          lithotriptor.
   Homer: How hard can it be?
   -- `If I Only Had a Brain' in Simpsons ep. 8F02, ``Treehouse of Horror II''

/be
Assignee: jst → brendan
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Target Milestone: Future → M18
Priority: P3 → P2
Whiteboard: [nsbeta3-][egk] → [nsbeta3+]
As a DOM0 backward compatibility bug, this qualifies for P2 status (high profile
backward compatbility--JS 1.1 on forms, which is one of the most widespread uses
of JavaScript on the web). Setting P2. Brendan agreed to accept as [nsbeta3+]
and will try to evaluate problem and if possible submit fix by 9/21 with mozilla
reviewers approval.
This looks very much like a dup of bug 49120 which is on jokis plate, joki has a
plan of attack and will probably fix this next week. I'm duping this bug but
please undupe if this is not a duplicate.


*** This bug has been marked as a duplicate of 49120 ***
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Verified Duplicate.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.